Resource Monitoring is a pseudo cluster. It has no cluster ID. It exists only to be aliased into other clusters.
To use a Resource Monitoring aliased cluster, you need to
- Create a class that inherits the
ResourceMonitoring::Instance
class. For examples look at the files in thesrc/instances
andinclude/instances
directories inexamples/resource-monitoring-app/
. - For this class implement the
OnResetCondition
method. Look at the documentation inresource-monitoring-server.h
for more information about these methods. Cluster-specific enums can be accessed from the cluster namespace. - Optionally implement the
AppInit
method. - In your main file, instantiate your
ResourceMonitoring::Instance
inherited class. See the constructor documentation inresource-monitoring-server.h
. - Call the
.Init()
function of your instance.
Note Zap accessor functions for these clusters will not return true values.
Use the instance's Update...
and Get...
functions to access the attributes.
Once a Resource Monitoring aliased cluster has been defined in the spec, adding the implementation to Resource Monitoring using the following steps
- Translate the spec as an XML in
src/app/zap-templates/zcl/data-model/chip
. You can look at similar files on how to do this. - Add the cluster ID to
AliasedClusters
inresource-monitoring-cluster-objects.h
. - Regenerate the zap code.
- Extend the all-clusters-app/resource-monitoring example to include your new cluster.