tree: 9f9940136ddc1a9d0ce5ba25e335ed8ca25343c4 [path history] [tgz]
  1. tests/
  2. app_config_dependent_sources.cmake
  3. app_config_dependent_sources.gni
  4. BUILD.gn
  5. CodegenIntegration.cpp
  6. CodegenIntegration.h
  7. README.md
  8. switch-server.h
  9. SwitchCluster.cpp
  10. SwitchCluster.h
src/app/clusters/switch-server/README.md

This cluster is currently following a code driven approach.

This means that the Accessors for the attribute CurrentPosition are no longer available.

Now to set the value for this attribute the following code change applies:

BEFORE (using the Accessors)

app::Clusters::Switch::Attributes::CurrentPosition::Set(1, position);

CURRENT (using the code driven approach)

auto switchCluster = app::Clusters::Switch::FindClusterOnEndpoint(1);
VerifyOrReturn(switchCluster != nullptr);

CHIP_ERROR err = switchCluster->SetCurrentPosition(position);
if (err == CHIP_NO_ERROR)
{
    // SetCurrentPosition() succeeded.
}
else
{
    // SetCurrentPosition() failed.
}

Attributes with Quality F (Fixed) are configuration values that the cluster takes from ember and can not be changed.

Attributes with Quality F (Fixed) maintain the Accessors but only for reading the value (getters).

Also the code to register the events needs to change, for example:

BEFORE

Clusters::SwitchServer::Instance().OnSwitchLatch(1, position);

CURRENT

auto switchCluster = app::Clusters::Switch::FindClusterOnEndpoint(1);
VerifyOrReturn(switchCluster != nullptr);

auto event = switchCluster->OnSwitchLatch(position);
if (event.has_value())
{
    OnSwitchLatch() succeeded.
}
else
{
    OnSwitchLatch() failed.
}