|
8 | 8 | #include <credentials/GroupDataProvider.h> |
9 | 9 | #include <lib/core/CHIPError.h> |
10 | 10 | #include <lib/support/CodeUtils.h> |
| 11 | +#include <transport/raw/GroupcastTesting.h> |
11 | 12 |
|
12 | 13 | using chip::Protocols::InteractionModel::Status; |
13 | 14 |
|
14 | 15 | using namespace chip::Credentials; |
15 | | -using GroupDataProvider = GroupDataProvider; |
16 | 16 | using GroupInfo = GroupDataProvider::GroupInfo; |
17 | 17 | using GroupEndpoint = GroupDataProvider::GroupEndpoint; |
18 | 18 | using GroupInfoIterator = GroupDataProvider::GroupInfoIterator; |
@@ -89,7 +89,7 @@ DataModel::ActionReturnStatus GroupcastCluster::ReadAttribute(const DataModel::R |
89 | 89 | case Groupcast::Attributes::UsedMcastAddrCount::Id: |
90 | 90 | return ReadUsedMcastAddrCount(request.path.mEndpointId, encoder); |
91 | 91 | case Groupcast::Attributes::FabricUnderTest::Id: |
92 | | - return encoder.Encode(mFabricUnderTest); |
| 92 | + return encoder.Encode(chip::Groupcast::GetTesting().GetFabricIndex()); |
93 | 93 | } |
94 | 94 | return Protocols::InteractionModel::Status::UnsupportedAttribute; |
95 | 95 | } |
@@ -174,7 +174,8 @@ CHIP_ERROR GroupcastCluster::GeneratedCommands(const ConcreteClusterPath & path, |
174 | 174 |
|
175 | 175 | Status GroupcastCluster::GroupcastTesting(FabricIndex fabricIndex, Groupcast::Commands::GroupcastTesting::DecodableType data) |
176 | 176 | { |
177 | | - VerifyOrReturnError(mFabricUnderTest == kUndefinedFabricIndex || mFabricUnderTest == fabricIndex, Status::ConstraintError); |
| 177 | + FabricIndex fabricUnderTest = chip::Groupcast::GetTesting().GetFabricIndex(); |
| 178 | + VerifyOrReturnError(fabricUnderTest == kUndefinedFabricIndex || fabricUnderTest == fabricIndex, Status::ConstraintError); |
178 | 179 |
|
179 | 180 | if (data.testOperation == Groupcast::GroupcastTestingEnum::kDisableTesting) |
180 | 181 | { |
@@ -205,7 +206,14 @@ Status GroupcastCluster::GroupcastTesting(FabricIndex fabricIndex, Groupcast::Co |
205 | 206 |
|
206 | 207 | void GroupcastCluster::SetFabricUnderTest(FabricIndex fabricUnderTest) |
207 | 208 | { |
208 | | - SetAttributeValue(mFabricUnderTest, fabricUnderTest, Groupcast::Attributes::FabricUnderTest::Id); |
| 209 | + auto & testing = chip::Groupcast::GetTesting(); |
| 210 | + if (fabricUnderTest != testing.GetFabricIndex()) |
| 211 | + { |
| 212 | + testing.Clear(); |
| 213 | + testing.SetFabricIndex(fabricUnderTest); |
| 214 | + NotifyAttributeChanged(Groupcast::Attributes::FabricUnderTest::Id); |
| 215 | + } |
| 216 | + testing.SetEnabled(fabricUnderTest != kUndefinedFabricIndex); |
209 | 217 | } |
210 | 218 |
|
211 | 219 | // MembershipChangedTimer implementation |
|
0 commit comments