3 * Copyright (c) 2020 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.
20 * Copyright (c) 2020 Silicon Labs
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
26 * http://www.apache.org/licenses/LICENSE-2.0
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 /***************************************************************************/
37 * @brief This file contains a function that processes
38 *cluster-specific ZCL message.
39 *******************************************************************************
40 ******************************************************************************/
42 // this file contains all the common includes for clusters in the zcl-util
43 #include "app/util/common.h"
45 // for pulling in defines dealing with EITHER server or client
48 #include "gen/cluster-id.h"
50 // the EM260 host needs to include the config file
55 //------------------------------------------------------------------------------
57 bool emAfProcessClusterSpecificCommand(EmberAfClusterCommand * cmd)
61 // if we are disabled then we can only respond to read or write commands
62 // or identify cluster (see device enabled attr of basic cluster)
63 if (!emberAfIsDeviceEnabled(cmd->apsFrame->destinationEndpoint) && cmd->apsFrame->clusterId != ZCL_IDENTIFY_CLUSTER_ID)
65 emberAfCorePrintln("%pd, dropping ep 0x%x clus 0x%2x cmd 0x%x", "disable", cmd->apsFrame->destinationEndpoint,
66 cmd->apsFrame->clusterId, cmd->commandId);
67 emberAfSendDefaultResponse(cmd, EMBER_ZCL_STATUS_FAILURE);
71 #ifdef ZCL_USING_KEY_ESTABLISHMENT_CLUSTER_CLIENT
72 if (cmd->apsFrame->clusterId == ZCL_KEY_ESTABLISHMENT_CLUSTER_ID && cmd->direction == ZCL_DIRECTION_SERVER_TO_CLIENT &&
73 emberAfKeyEstablishmentClusterClientCommandReceivedCallback(cmd))
78 #ifdef ZCL_USING_KEY_ESTABLISHMENT_CLUSTER_SERVER
79 if (cmd->apsFrame->clusterId == ZCL_KEY_ESTABLISHMENT_CLUSTER_ID && cmd->direction == ZCL_DIRECTION_CLIENT_TO_SERVER &&
80 emberAfKeyEstablishmentClusterServerCommandReceivedCallback(cmd))
86 #ifdef ZCL_USING_OTA_BOOTLOAD_CLUSTER_CLIENT
87 if (cmd->apsFrame->clusterId == ZCL_OTA_BOOTLOAD_CLUSTER_ID && cmd->direction == ZCL_DIRECTION_SERVER_TO_CLIENT &&
88 emberAfOtaClientIncomingMessageRawCallback(cmd))
93 #ifdef ZCL_USING_OTA_BOOTLOAD_CLUSTER_SERVER
94 if (cmd->apsFrame->clusterId == ZCL_OTA_BOOTLOAD_CLUSTER_ID && cmd->direction == ZCL_DIRECTION_CLIENT_TO_SERVER &&
95 emberAfOtaServerIncomingMessageRawCallback(cmd))
101 // Pass the command to the generated command parser for processing
102 status = emberAfClusterSpecificCommandParse(cmd);
103 if (status != EMBER_ZCL_STATUS_SUCCESS)
105 emberAfSendDefaultResponse(cmd, status);