chrisdecenzo | f7b39db | 2022-04-06 14:18:39 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 28 | using namespace ::chip; |
| 29 | using namespace ::chip::app::Clusters; |
| 30 | |
Boris Zbarsky | df644b2 | 2022-04-30 01:34:04 -0400 | [diff] [blame] | 31 | void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, |
| 32 | uint8_t * value) |
chrisdecenzo | f7b39db | 2022-04-06 14:18:39 -0700 | [diff] [blame] | 33 | { |
| 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-menzopol | 57471cb | 2022-04-20 23:31:17 +0300 | [diff] [blame] | 40 | ChipLogProgress(Zcl, "OnOff attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", ChipLogValueMEI(attributeId), |
| 41 | type, *value, size); |
chrisdecenzo | f7b39db | 2022-04-06 14:18:39 -0700 | [diff] [blame] | 42 | } |
| 43 | else if (clusterId == LevelControl::Id) |
| 44 | { |
andrei-menzopol | 57471cb | 2022-04-20 23:31:17 +0300 | [diff] [blame] | 45 | ChipLogProgress(Zcl, "Level Control attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", |
chrisdecenzo | f7b39db | 2022-04-06 14:18:39 -0700 | [diff] [blame] | 46 | 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 | */ |
| 67 | void emberAfOnOffClusterInitCallback(EndpointId endpoint) |
| 68 | { |
| 69 | // TODO: implement any additional Cluster Server init actions |
| 70 | } |