@@ -28,17 +28,34 @@ using namespace chip::app::Clusters::ResourceMonitoring;
28
28
using chip::Protocols::InteractionModel::Status;
29
29
30
30
constexpr std::bitset<4 > gHepaFilterFeatureMap { static_cast <uint32_t >(Feature::kCondition ) |
31
- static_cast <uint32_t >(Feature::kWarning ) };
31
+ static_cast <uint32_t >(Feature::kWarning ) |
32
+ static_cast <uint32_t >(Feature::kReplacementProductList ) };
32
33
constexpr std::bitset<4 > gActivatedCarbonFeatureMap { static_cast <uint32_t >(Feature::kCondition ) |
33
- static_cast <uint32_t >(Feature::kWarning ) };
34
+ static_cast <uint32_t >(Feature::kWarning ) |
35
+ static_cast <uint32_t >(Feature::kReplacementProductList ) };
34
36
35
- static HepaFilterMonitoringInstance * gHepafilterInstance = nullptr ;
37
+ static HepaFilterMonitoringInstance * gHepaFilterInstance = nullptr ;
36
38
static ActivatedCarbonFilterMonitoringInstance * gActivatedCarbonFilterInstance = nullptr ;
37
39
40
+ static ResourceMonitoring::Attributes::ReplacementProductStruct::Type sReplacementProductsList [] = {
41
+ { .productIdentifierType = ProductIdentifierTypeEnum::kUpc ,
42
+ .productIdentifierValue = CharSpan::fromCharString (" 111112222233" ) },
43
+ { .productIdentifierType = ProductIdentifierTypeEnum::kGtin8 , .productIdentifierValue = CharSpan::fromCharString (" gtin8xxx" ) },
44
+ { .productIdentifierType = ProductIdentifierTypeEnum::kEan ,
45
+ .productIdentifierValue = CharSpan::fromCharString (" 4444455555666" ) },
46
+ { .productIdentifierType = ProductIdentifierTypeEnum::kGtin14 ,
47
+ .productIdentifierValue = CharSpan::fromCharString (" gtin14xxxxxxxx" ) },
48
+ { .productIdentifierType = ProductIdentifierTypeEnum::kOem ,
49
+ .productIdentifierValue = CharSpan::fromCharString (" oem20xxxxxxxxxxxxxxx" ) },
50
+ };
51
+ StaticReplacementProductListManager sReplacementProductListManager (&sReplacementProductsList [0 ],
52
+ ArraySize (sReplacementProductsList ));
53
+
38
54
// -- Activated Carbon Filter Monitoring Instance methods
39
55
CHIP_ERROR ActivatedCarbonFilterMonitoringInstance::AppInit ()
40
56
{
41
57
ChipLogDetail (Zcl, " ActivatedCarbonFilterMonitoringDelegate::Init()" );
58
+ SetReplacementProductListManagerInstance (&sReplacementProductListManager );
42
59
return CHIP_NO_ERROR;
43
60
}
44
61
@@ -58,6 +75,7 @@ Status ActivatedCarbonFilterMonitoringInstance::PostResetCondition()
58
75
CHIP_ERROR HepaFilterMonitoringInstance::AppInit ()
59
76
{
60
77
ChipLogDetail (Zcl, " HepaFilterMonitoringInstance::Init()" );
78
+ SetReplacementProductListManagerInstance (&sReplacementProductListManager );
61
79
return CHIP_NO_ERROR;
62
80
}
63
81
@@ -82,8 +100,19 @@ void emberAfActivatedCarbonFilterMonitoringClusterInitCallback(chip::EndpointId
82
100
}
83
101
void emberAfHepaFilterMonitoringClusterInitCallback (chip::EndpointId endpoint)
84
102
{
85
- VerifyOrDie (gActivatedCarbonFilterInstance == nullptr );
86
- gHepafilterInstance = new HepaFilterMonitoringInstance (endpoint, static_cast <uint32_t >(gHepaFilterFeatureMap .to_ulong ()),
103
+ gHepaFilterInstance = new HepaFilterMonitoringInstance (endpoint, static_cast <uint32_t >(gHepaFilterFeatureMap .to_ulong ()),
87
104
DegradationDirectionEnum::kDown , true );
88
- gHepafilterInstance ->Init ();
105
+ gHepaFilterInstance ->Init ();
106
+ }
107
+
108
+ CHIP_ERROR StaticReplacementProductListManager::Next (Attributes::ReplacementProductStruct::Type & item)
109
+ {
110
+ if (mIndex < mReplacementProductListSize )
111
+ {
112
+ item = mReplacementProductsList [mIndex ];
113
+ mIndex ++;
114
+ return CHIP_NO_ERROR;
115
+ }
116
+
117
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
89
118
}
0 commit comments