-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Resource Monitoring to Separate out The Delegate functionali…
…ty (#28725) * Move Constructors And Destructors To The Top Of The Instance * Add Delegate Instead Of Just The Instance Following the Mode Base Cluster, to make it more similar. * Use New Delegate In Resource-Monitoring-App Example * Rename "instances" Folder to "delegates" also adjust include paths and BUILD.gn paths * Use New Resource Monitoring Delegate In All-Cluster-App Example * Fix Typo * Rename "resource-monitoring-instances.h/cpp" To "resource-monitoring-delegates.h/cpp" * Add Shutdown Methods For All-Cluster-App * Fix Some Comments And Logs * Restyled by whitespace * Restyled by clang-format * Fix Build Error From Merge * Fix Build Error * Add Missing Destructor needs to unregister Command Handler and Attribute Accesser * Restyled by whitespace * Restyled by clang-format * Fix Spelling * Remove `isValidAliascluster` method it should be the SDK user's responsibility to select the correct cluster ID and that it also requires the maintenance of a global list. * Make Instance A Friend Of Delegate -> make mInstance private with private setter and protected getter * Restyled by whitespace * Restyled by clang-format * Fix Build Error --------- Co-authored-by: Restyled.io <commits@restyled.io>
- Loading branch information
Showing
30 changed files
with
421 additions
and
334 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
examples/all-clusters-app/all-clusters-common/include/resource-monitoring-delegates.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <app-common/zap-generated/ids/Attributes.h> | ||
#include <app-common/zap-generated/ids/Clusters.h> | ||
#include <app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.h> | ||
#include <app/clusters/resource-monitoring-server/resource-monitoring-server.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
namespace Clusters { | ||
|
||
namespace ActivatedCarbonFilterMonitoring { | ||
/// This is an application level Delegate to handle ActivatedCarbonfilterMonitoringDelegate commands according to the specific | ||
/// business logic. | ||
class ActivatedCarbonFilterMonitoringDelegate : public ResourceMonitoring::Delegate | ||
{ | ||
private: | ||
CHIP_ERROR Init() override; | ||
chip::Protocols::InteractionModel::Status PreResetCondition() override; | ||
chip::Protocols::InteractionModel::Status PostResetCondition() override; | ||
|
||
public: | ||
~ActivatedCarbonFilterMonitoringDelegate() override = default; | ||
}; | ||
|
||
void Shutdown(); | ||
|
||
} // namespace ActivatedCarbonFilterMonitoring | ||
|
||
namespace HepaFilterMonitoring { | ||
/// This is an application level Delegate to handle HepaFilterMonitoringDelegate commands according to the specific business logic. | ||
class HepaFilterMonitoringDelegate : public ResourceMonitoring::Delegate | ||
{ | ||
private: | ||
CHIP_ERROR Init() override; | ||
chip::Protocols::InteractionModel::Status PreResetCondition() override; | ||
chip::Protocols::InteractionModel::Status PostResetCondition() override; | ||
|
||
public: | ||
~HepaFilterMonitoringDelegate() override = default; | ||
}; | ||
|
||
class ImmutableReplacementProductListManager : public ResourceMonitoring::ReplacementProductListManager | ||
{ | ||
public: | ||
CHIP_ERROR | ||
Next(chip::app::Clusters::ResourceMonitoring::ReplacementProductStruct & item) override; | ||
}; | ||
|
||
void Shutdown(); | ||
|
||
} // namespace HepaFilterMonitoring | ||
|
||
} // namespace Clusters | ||
} // namespace app | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.