Skip to content

Commit 76717c7

Browse files
authored
Merge pull request #26 from SiliconLabsSoftware/rename-zcl-callbacks
Rename ZclCallbacks.cpp to DataModelCallbacks.cpp
2 parents 039b630 + a5e88e7 commit 76717c7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sld295-matter-api-reference/attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Attributes represent the current state of a device. For instance if the device i
44

55
## Attribute Changes
66

7-
When a ZCL attribute is updated in the data model, the framework will call the `postAttributeChangeCallback`. If this callback is implemented by the device it will be informed of the attribute change. The device may react to the attribute change. For example, in the [MatterPostAttributeChangeCallback](https://github.com/SiliconLabs/matter_extension/blob/main/examples/onoff-plug-app/src/ZclCallbacks.cpp#L38), say we want to add some custom handler code to control an RGB LED when on/off attribute in the `On-Off` Cluster changes:
7+
When a ZCL attribute is updated in the data model, the framework will call the `postAttributeChangeCallback`. If this callback is implemented by the device it will be informed of the attribute change. The device may react to the attribute change. For example, in `MatterPostAttributeChangeCallback` in `DataModelCallbacks.cpp` in [onoff-plug-app/src](https://github.com/SiliconLabs/matter_extension/tree/main/examples/onoff-plug-app/src), say we want to add some custom handler code to control an RGB LED when on/off attribute in the `On-Off` Cluster changes:
88

99
```cpp
1010
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath,

sld601-matter-application-development/matter-application-cluster-logic.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void AppTask::OnOffAttributeWriteStartTimer()
100100

101101
This function will have to be defined in AppTask.h as well as part of the AppTask class.
102102

103-
Now, locate the `MatterPostAttributeChangeCallback()` function in the `src/ZclCallbacks.cpp` file. This function is invoked by the application framework after an attribute value has been changed. Because you are modifying the OnOff attribute in the `OnOffTmrExpiryHandler()` function, use this callback to re-initiate the timer so that the attribute continues to toggle. To achieve this, call `AppTask::OnOffAttributeWriteStartTimer()`, which is part of the AppTask context.
103+
Now, locate the `MatterPostAttributeChangeCallback()` function in the `src/DataModelCallbacks.cpp` file. This function is invoked by the application framework after an attribute value has been changed. Because you are modifying the OnOff attribute in the `OnOffTmrExpiryHandler()` function, use this callback to re-initiate the timer so that the attribute continues to toggle. To achieve this, call `AppTask::OnOffAttributeWriteStartTimer()`, which is part of the AppTask context.
104104

105105
To implement this functionality, first obtain the AppTask instance using `AppTask::GetAppTask()`. Modify the `MatterPostAttributeChangeCallback()` function as shown below:
106106

@@ -119,7 +119,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
119119

120120
}
121121
```
122-
Make sure to #include "AppTask.h" at the top of the `ZclCallbacks.cpp` file to call the `AppTask::GetAppTask()` function. For more information on the AppTask, refer to AppTask.h.
122+
Make sure to #include "AppTask.h" at the top of the `DataModelCallbacks.cpp` file to call the `AppTask::GetAppTask()` function. For more information on the AppTask, refer to AppTask.h.
123123
124124
Finally, add a call to `OnOffTmrStart()` at the end of the `AppTask::AppInit()` function to start the attribute write sequence. The following image illustrates the code flow:
125125

sld601-matter-application-development/matter-scenes-quick-start-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ public:
165165

166166
### Step 3 Implement Callbacks
167167

168-
Make the following additions to the src/ZclCallbacks.cpp file:
168+
Make the following additions to the src/DataModelCallbacks.cpp file:
169169

170-
:::collapsed{summary="Click to expand and view the ZclCallbacks.cpp file"}
170+
:::collapsed{summary="Click to expand and view the DataModelCallbacks.cpp file"}
171171
```c++
172172
// Color Transformer
173173
#include "ColorTransformer.h"
@@ -192,7 +192,7 @@ bool xyFlag = false;
192192
```
193193
:::
194194

195-
Then, inside `MatterPostAttributeChangeCallback` in _src/ZclCallbacks.cpp_, implement the on/off functionality of the LED:
195+
Then, inside `MatterPostAttributeChangeCallback` in _src/DataModelCallbacks.cpp_, implement the on/off functionality of the LED:
196196

197197
```c++
198198
if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)

0 commit comments

Comments
 (0)