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

[FanControl] Adding Delegate to allow application to handle Step command #28000

Merged

Conversation

mhazley
Copy link
Contributor

@mhazley mhazley commented Jul 17, 2023

Description

This PR adds a basic Delegate class to the FanControl cluster that allows the application to handle the Step command how it sees fit.

I have added a Delegate table as per window-covering-server, media-playback-server etc and then a Set.. and Get... .

I've then also extended the class in fan-stub.cpp in all-clusters-app to implement an example of the Delegate function.

Links

Fixes #27328

mhazley added 3 commits July 17, 2023 17:27
…tion can implement to handle the Step Command. Added Set and Get functions and a class definition with a virtual function that can be implemented.
@woody-apple
Copy link
Contributor

@jmartinez-silabs To review, and maybe @bzbarsky-apple .

@mhazley mhazley requested a review from jmartinez-silabs July 19, 2023 10:22
@jmartinez-silabs jmartinez-silabs merged commit b10de46 into project-chip:master Jul 19, 2023
EndpointId endpoint = commandPath.mEndpointId;
StepDirectionEnum direction = commandData.direction;

bool wrapValue = commandData.wrap.HasValue() ? commandData.wrap.Value() : false;
Copy link
Contributor

Choose a reason for hiding this comment

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

@mhazley For future reference:

bool wrapValue      = commandData.wrap.ValueOr(false);

}
else
{
ChipLogProgress(Zcl, "FanControl has no delegate set for endpoint:%u", endpoint);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should lack of delegate really respond with success?

erwinpan1 pushed a commit to erwinpan1/connectedhomeip that referenced this pull request Jul 21, 2023
…command (project-chip#28000)

* Added support for a basic FanControl::Delegate class that the application can implement to handle the Step Command. Added Set and Get functions and a class definition with a virtual function that can be implemented.

* Extended the fan-stub class to also inherit the Delegate and wrote an example handler for the Step function

* Turned on the available features for the ci tests

* Restyled by whitespace

* Included optional header so can use std::optional

* Removing use of optional as it is not building on certain platforms in CI

* Simplified the HandleStep callback and also added support for when Speed is Null

* Initialising uninitialised value in HandleStep

---------

Co-authored-by: Restyled.io <[email protected]>
@mhazley mhazley deleted the fan-control-delegate-for-step branch July 28, 2023 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add delegate to Fan Control to support application specific Step Command
5 participants