Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure Dimension server cluster code #2

Open
wants to merge 4 commits into
base: feature/closure_dimension_cluster_xml_zap_code_generation
Choose a base branch
from

Conversation

sabollim-silabs
Copy link
Collaborator

Closure dimension cluster server code

Testing

added closurebase endpoint on all-cluster-app to include closure dimension cluster as server and built app locally.

@github-actions github-actions bot added the app label Mar 17, 2025
@sabollim-silabs
Copy link
Collaborator Author

Updated the dimension server code as per new template

…on' into closure_dimension_cluster_server_code
{
inline bool HasFeature(Feature feature) const { return featureMap & to_underlying(feature); }
uint32_t featureMap;
bool supportsOverflow;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you keep a var supportsOverflow but not the others, HasFeature can be used for all of them no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overflow attribute is mandatory with the Rotation feature and optional with MotionLatching feature.
It is the device's responsibility to specify whether this attribute is supported. The values will be set using Clusterconformance struct.

// {
// }

CHIP_ERROR ClusterStateAttributes::SetCurrent(GenericCurrentStruct & current)
Copy link

@jmartinez-silabs jmartinez-silabs Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current attribute has the Quiet Reporting quality

Changes to this attribute SHALL only be marked as reportable in the following cases:

At most once every 5 seconds on changes when only the Position changes, or

When it changes from null to any other value and vice versa.

When Target.Position is reached.

When Target.Speed changes.

When Target.Latching changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure , will change it to quiet reporting.

using namespace Protocols::InteractionModel;
namespace {

CHIP_ERROR TranslateErrorToIMStatus(CHIP_ERROR err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a switch case. Please add function comments that also documents the mapping between the chip error and the im error code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

switch (aPath.mAttributeId)
{
case Current::Id: {
typedef GenericCurrentStruct T;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting the Typedef from the function call doesn't server any purpose. This applies to all following cases.

Comment on lines +21 to +28
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/AttributeAccessInterface.h>
#include <app/AttributeAccessInterfaceRegistry.h>
#include <app/CommandHandlerInterface.h>
#include <app/ConcreteCommandPath.h>
#include <app/data-model/Encode.h>
#include <app/util/config.h>
#include <lib/core/CHIPError.h>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all these necessary?

Comment on lines +40 to +41
uint32_t featureMap;
bool supportsOverflow;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should always set a default value.

{
bool supportsRotation = HasFeature(Feature::kRotation);
bool supportsMotionLatching = HasFeature(Feature::kMotionLatching);
if (supportsOverflow && !(supportsRotation || supportsMotionLatching))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supportsOverflow isn't set any where and the default value isn't set. How does this behave?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants