forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ReplacementProductList to Resource Monitoring Cluster (project-ch…
…ip#28095) * Add ReplacementProductList to Resource Monitoring Cluster This adds the implementation to fetch the replacement product list from the aliased resource-monitoring-cluster. It adds support for Hepa and Activated Carbon filter examples. Closes out issues project-chip#27802, project-chip#27801, project-chip#27577 ### Testing I tested this using the all-clusters-app and the resource-monitoring-example-app ``` >>>> hepafiltermonitoring read replacement-product-list 0x1 0x1 DataVersion = 0xd31d0b60, AttributePathIB = { Endpoint = 0x1, Cluster = 0x71, Attribute = 0x0000_0005, } Data = [ { 0x0 = 0, 0x1 = "upc12xhepaxx" (13 chars), }, { 0x0 = 1, 0x1 = "gtin8xhe" (9 chars), }, { 0x0 = 2, 0x1 = "ean13xhepaxxx" (14 chars), }, ], >>>> activatedcarbonfiltermonitoring read replacement-product-list 0x1 0x1 DataVersion = 0xfd145260, AttributePathIB = { Endpoint = 0x1, Cluster = 0x72, Attribute = 0x0000_0005, } Data = [ { 0x0 = 0, 0x1 = "upc12xcarbon" (13 chars), }, { 0x0 = 1, 0x1 = "gtin8xca" (9 chars), }, { 0x0 = 2, 0x1 = "ean13xacarbon" (14 chars), }, ], ``` * Addressing @tobiasgraf's comments * Addressing @tcarmelveilleux's comments and restyled * Simplifying example app and adding support for resource monitor list in the all clusters app * Addressing @tcarmelveilleux's suggestions * Restyled by whitespace * Restyled by clang-format --------- Co-authored-by: Restyled.io <[email protected]>
- Loading branch information
1 parent
ddd5861
commit d2d4701
Showing
32 changed files
with
691 additions
and
74 deletions.
There are no files selected for viewing
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
57 changes: 57 additions & 0 deletions
57
...e-monitoring-app/resource-monitoring-common/include/StaticReplacementProductListManager.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,57 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <app/clusters/resource-monitoring-server/replacement-product-list-manager.h> | ||
#include <app/util/af.h> | ||
#include <app/util/config.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
namespace Clusters { | ||
namespace ResourceMonitoring { | ||
|
||
/** | ||
* This implementation statically defines the options. | ||
*/ | ||
|
||
class StaticReplacementProductListManager : public ReplacementProductListManager | ||
{ | ||
public: | ||
uint8_t Size() override { return mReplacementProductListSize; }; | ||
|
||
CHIP_ERROR Next(Attributes::ReplacementProductStruct::Type & item) override; | ||
|
||
~StaticReplacementProductListManager() {} | ||
StaticReplacementProductListManager(Attributes::ReplacementProductStruct::Type * aReplacementProductsList, | ||
uint8_t aReplacementProductListSize) | ||
{ | ||
mReplacementProductsList = aReplacementProductsList; | ||
mReplacementProductListSize = aReplacementProductListSize; | ||
} | ||
|
||
private: | ||
Attributes::ReplacementProductStruct::Type * mReplacementProductsList; | ||
uint8_t mReplacementProductListSize; | ||
}; | ||
|
||
} // namespace ResourceMonitoring | ||
} // 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
Oops, something went wrong.