3 * Copyright (c) 2021 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 // THIS FILE IS GENERATED BY ZAP
23 #include "af-structs.h"
24 #include "call-command-handler.h"
26 #include "cluster-id.h"
27 #include "command-id.h"
30 #include <app/InteractionModelEngine.h>
32 // Currently we need some work to keep compatible with ember lib.
33 #include <util/ember-compatibility-functions.h>
38 // Cluster specific command parsing
44 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
49 case ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID: {
50 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
51 emberAfBasicClusterResetToFactoryDefaultsCallback();
55 // Unrecognized command ID, error status will apply.
56 // TODO: Encode response for command not found
57 ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_BASIC_CLUSTER_ID);
66 } // namespace clusters
68 void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId,
69 chip::TLV::TLVReader & aReader, Command * apCommandObj)
71 ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx16 " Command=%" PRIx8 " Endpoint=%" PRIx8, aClusterId, aCommandId,
73 Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
76 case ZCL_BASIC_CLUSTER_ID:
77 clusters::Basic::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
80 // Unrecognized cluster ID, error status will apply.
81 // TODO: Encode response for Cluster not found
82 ChipLogError(Zcl, "Unknown cluster %" PRIx16, aClusterId);
85 Compatibility::ResetEmberAfObjects();