Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Jan 31, 2025
1 parent 752d2f6 commit 7ed7fff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,8 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV:
errorStatus = Clusters::WindowCovering::DispatchServerCommand(apCommandObj, aCommandPath, aReader);
break;
default:
// If we already validated that the cluster does indeed exist in our CHI,
// If we already validated that the cluster does indeed exist (e.g. when dispatching to CommandHandlerInterface for that
// cluster).
if (aClusterIsValid)
{
errorStatus = Protocols::InteractionModel::Status::UnsupportedCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,8 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV:
errorStatus = Clusters::ThreadNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader);
break;
default:
// If we already validated that the cluster does indeed exist in our CHI,
// If we already validated that the cluster does indeed exist (e.g. when dispatching to CommandHandlerInterface for that
// cluster).
if (aClusterIsValid)
{
errorStatus = Protocols::InteractionModel::Status::UnsupportedCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ std::optional<DataModel::ActionReturnStatus> CodegenDataModelProvider::Invoke(co
CommandHandlerInterface * handler_interface =
CommandHandlerInterfaceRegistry::Instance().GetCommandHandler(request.path.mEndpointId, request.path.mClusterId);

if (handler_interface)
// Some CommandHandlerInterface instances are registered of ALL endpoints, so make sure first that
// the cluster actually exists on this endpoint before asking the CommandHandlerInterface whether it
// supports the command.
const bool clusterIsPresent = (FindServerCluster(request.path) != nullptr);

if (clusterIsPresent && handler_interface)
{
clusterRecognizedByCHI = true;
CommandHandlerInterface::HandlerContext context(*handler, request.path, input_arguments);
Expand Down

0 comments on commit 7ed7fff

Please sign in to comment.