Mode Base is a pseudo cluster. It has no cluster ID. It exists only to be derived from by other clusters.
To use a Mode Base derived cluster, you need to
ModeBase::Delegate
class. For simple examples that store all their data in memory, look at the <alias name>-mode.*
files in the src
and include
directories in examples/all-clusters-app/all-clusters-common
.GetModeLabelByIndex
, GetModeValueByIndex
, GetModeTagsByIndex
and HandleChangeToMode
methods. Look at the documentation in mode-base-server.h
for more information about these methods. Cluster-specific enums can be accessed from the cluster namespace.Init
function.ModeBase::Instance
inherited class. See the constructor documentation in mode-base-server.h
..Init()
function of your instance after the root Server::Init()
.emberAf<ClusterName>ClusterInitCallback
function.#define MATTER_DM_PLUGIN_MODE_BASE
to your chip_device_project_config_include
file. In the examples, this file is CHIPProjectAppConfig.h
.Note Zap accessor functions for these clusters do not exist. Use the instance's Update...
and Get...
functions to access the attributes.
Once a Mode Base derived cluster has been defined in the spec, add the implementation using the following steps
src/app/zap-templates/zcl/data-model/chip
. You can look at similar files on how to do this.