blob: 0fe95c9aef6642c3c2a20e35b0cd064ab62188f5 [file] [log] [blame]
chrisdecenzof7b39db2022-04-06 14:18:39 -07001/*
2 *
3 * Copyright (c) 2020 Project CHIP Authors
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17
18/**
19 * @file
20 * This file implements the handler for data model messages.
21 */
22
23#include <app-common/zap-generated/ids/Attributes.h>
24#include <app-common/zap-generated/ids/Clusters.h>
25#include <app/ConcreteAttributePath.h>
26#include <lib/support/logging/CHIPLogging.h>
27
28using namespace ::chip;
29using namespace ::chip::app::Clusters;
30
Boris Zbarskydf644b22022-04-30 01:34:04 -040031void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
32 uint8_t * value)
chrisdecenzof7b39db2022-04-06 14:18:39 -070033{
34 ClusterId clusterId = attributePath.mClusterId;
35 AttributeId attributeId = attributePath.mAttributeId;
36 ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
37
38 if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)
39 {
andrei-menzopol57471cb2022-04-20 23:31:17 +030040 ChipLogProgress(Zcl, "OnOff attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", ChipLogValueMEI(attributeId),
41 type, *value, size);
chrisdecenzof7b39db2022-04-06 14:18:39 -070042 }
43 else if (clusterId == LevelControl::Id)
44 {
andrei-menzopol57471cb2022-04-20 23:31:17 +030045 ChipLogProgress(Zcl, "Level Control attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
chrisdecenzof7b39db2022-04-06 14:18:39 -070046 ChipLogValueMEI(attributeId), type, *value, size);
47
48 // WIP Apply attribute change to Light
49 }
50}
51
52/** @brief OnOff Cluster Init
53 *
54 * This function is called when a specific cluster is initialized. It gives the
55 * application an opportunity to take care of cluster initialization procedures.
56 * It is called exactly once for each endpoint where cluster is present.
57 *
58 * @param endpoint Ver.: always
59 *
60 * TODO Issue #3841
61 * emberAfOnOffClusterInitCallback happens before the stack initialize the cluster
62 * attributes to the default value.
63 * The logic here expects something similar to the deprecated Plugins callback
64 * emberAfPluginOnOffClusterServerPostInitCallback.
65 *
66 */
67void emberAfOnOffClusterInitCallback(EndpointId endpoint)
68{
69 // TODO: implement any additional Cluster Server init actions
70}