You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable the On/Off cluster (0x0006) as both a Server and a Client. This should add mandatory attributes and commands as required by the spec for this cluster, these can be viewed by selecting the "Configure" icon.
39
+
Enable the On/Off cluster (0x0006) as both a Server and Client. This should add mandatory attributes and commands as required by the spec for this cluster, these can be viewed by selecting the "Configure" icon.
By configuring both a client and server for the On/Off cluster, the device should be able to transmit On/Off commands and store On/Off attributes. For this guide, we will mainly focus on the attribute storing and manipulation.
43
+
By configuring both a client and server for the On/Off cluster, the device should be able to transmit On/Off commands and store On/Off attributes. Normally, a light bulb acts as a server because it holds the On/Off state and responds to commands to change it. A light switch acts as a client because it sends commands to the bulb to turn it on or off, but doesn't store the state itself. For this guide, we will mainly focus on the attribute storing and manipulation.
44
44
45
45
Save the .zap file. The tool will automatically generate the necessary code files for your application, reflecting the new cluster configuration. For more information, reference [ZCL Advanced Platform (ZAP) Tool for Matter](https://docs.silabs.com/matter/latest/matter-references/matter-zap).
46
46
@@ -54,11 +54,11 @@ Now that the new On/Off cluster has been added to the Sample Door Lock project,
54
54
- Callback stubs are generated for you to implement application-specific behavior.
55
55
- You interact with the cluster by filling in these stubs and using the generated data structures.
56
56
57
-
You will also notice that following the cluster enablement, a corresponding component is automatically added to your project. This happens because enabling a cluster in ZAP updates your project configuration to include the necessary software components and libraries required to support that cluster’s functionality. For clusters, this functionality is implemented in the <matter_extension>/third_party/matter_sdk/src/app/clusters directory. For the On/Off cluster, the server command handlers and related logic can be found in te /on-off-server/on-off-server.cpp file.
57
+
You will also notice that following the cluster enablement, a corresponding component is automatically added to your project. This happens because enabling a cluster in ZAP updates your project configuration to include the necessary software components and libraries required to support that cluster’s functionality. For clusters, this functionality is implemented in the <matter_extension>/third_party/matter_sdk/src/app/clusters directory. For the On/Off cluster, the server command handlers and related logic can be found in the /on-off-server/on-off-server.cpp file.
58
58
59
59
## Step 4: Add Application Logic
60
60
61
-
Locate your projects src/AppTask.cpp file. This file acts as the central hub for application-specific logic, initialization, and event processing in a Matter application on Silicon Labs platforms. We will begin by creating two helper functions, one that starts a one-shot timer to expire in 10 seconds and the handler function, **OnOffTmrExpiryHandler**.
61
+
Locate your project's src/AppTask.cpp file. This file acts as the central hub for application-specific logic, initialization, and event processing in a Matter application on Silicon Labs platforms. We will begin by creating two helper functions, one that starts a one-shot timer to expire in 10 seconds and the handler function, **OnOffTmrExpiryHandler**.
@@ -100,7 +100,7 @@ This function will have to be defined in AppTask.h as well as part of the AppTas
100
100
101
101
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. Since we are modifying the OnOff attribute in the OnOffTmrExpiryHandler(), this callback will be used to re-initiate the timer so that the attribute continues to toggle. To achieve this, you can call AppTask::OnOffAttributeWriteStartTimer(), which is part of the AppTask context.
102
102
103
-
To implement this functionality, you must first obtain the AppTask instance using AppTask::GetAppTask(). Then, modify the MatterPostAttributeChangeCallback() function as shown below:
103
+
To implement this functionality, you must first obtain the AppTask instance using AppTask::GetAppTask(). Modify the MatterPostAttributeChangeCallback() function as shown below:
0 commit comments