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.
- Loading branch information
1 parent
4fa24ba
commit 9cdcd7c
Showing
9 changed files
with
105 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include <platform/silabs/MigrationManager.h> | ||
#include <credentials/GroupDataProviderImpl.h> | ||
#include <credentials/GroupDataProviderV2.h> | ||
#include <app/server/Server.h> | ||
|
||
namespace chip { | ||
namespace DeviceLayer { | ||
namespace Silabs { | ||
|
||
using namespace chip::Credentials; | ||
|
||
void MigrateGroupKVS(void) | ||
{ | ||
GroupDataProviderImpl provider1; | ||
GroupDataProviderV2 provider2; | ||
|
||
ChipLogProgress(Zcl, "~~~ FABRICS(%u)", (unsigned) Server::GetInstance().GetFabricTable().FabricCount()); | ||
|
||
for (auto & fabric : Server::GetInstance().GetFabricTable()) | ||
{ | ||
auto fabric_index = fabric.GetFabricIndex(); | ||
ChipLogProgress(Zcl, "~~~ FABRIC[%u]", (unsigned) fabric_index); | ||
|
||
// GroupInfo | ||
size_t index = 0; | ||
GroupDataProvider::GroupInfo group; | ||
auto it = provider1.IterateGroupInfo(fabric_index); | ||
while (it->Next(group)) | ||
{ | ||
ChipLogProgress(Zcl, "~~~ GROUP(%u)", (unsigned) group.group_id); | ||
provider2.SetGroupInfoAt(fabric_index, index++, group); | ||
} | ||
it->Release(); | ||
|
||
// Endpoints | ||
GroupDataProvider::GroupEndpoint endpoint; | ||
auto it2 = provider1.IterateEndpoints(fabric_index); | ||
while (it2->Next(endpoint)) | ||
{ | ||
ChipLogProgress(Zcl, "~~~ END(%u)", (unsigned) endpoint.endpoint_id); | ||
provider2.AddEndpoint(fabric_index, endpoint.group_id, endpoint.endpoint_id); | ||
} | ||
it2->Release(); | ||
|
||
// GroupKeys | ||
index = 0; | ||
GroupDataProvider::GroupKey pair; | ||
auto it3 = provider1.IterateGroupKeys(fabric_index); | ||
while (it3->Next(pair)) | ||
{ | ||
ChipLogProgress(Zcl, "~~~ KEYS(%u)", (unsigned) pair.keyset_id); | ||
provider2.SetGroupKeyAt(fabric_index, index++, pair); | ||
} | ||
it3->Release(); | ||
|
||
// KeySet | ||
index = 0; | ||
GroupDataProvider::KeySet keyset; | ||
auto it4 = provider1.IterateKeySets(fabric_index); | ||
while (it4->Next(keyset)) | ||
{ | ||
ChipLogProgress(Zcl, "~~~ KEYS(%u)", (unsigned) keyset.keyset_id); | ||
// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME | ||
auto compressedFabric = ByteSpan(); | ||
provider2.SetKeySet(fabric_index, compressedFabric, keyset); | ||
} | ||
it4->Release(); | ||
} | ||
|
||
|
||
} | ||
|
||
} // namespace Silabs | ||
} // namespace DeviceLayer | ||
} // 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