Skip to content

Commit

Permalink
[Silabs] Use provision storage manager singleton in OTA factory data …
Browse files Browse the repository at this point in the history
…processor (#34822)

* Use provision storage manager singleton

* Restyled by clang-format

* rekick ci

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Aug 9, 2024
1 parent 2cbb55f commit 66c43f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/platform/silabs/multi-ota/OTAFactoryDataProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace chip {

using FactoryProvider = DeviceLayer::Silabs::Provision::Storage;
using namespace ::chip::DeviceLayer::Silabs;

CHIP_ERROR OTAFactoryDataProcessor::Init()
{
Expand Down Expand Up @@ -146,21 +146,20 @@ CHIP_ERROR OTAFactoryDataProcessor::Update(uint8_t tag, Optional<ByteSpan> & opt

CHIP_ERROR OTAFactoryDataProcessor::UpdateValue(uint8_t tag, ByteSpan & newValue)
{
FactoryProvider factoryProvider;
switch (tag)
{
case (int) FactoryTags::kDacKey:
ChipLogProgress(SoftwareUpdate, "Set Device Attestation Key");
return factoryProvider.FactoryProvider::SetDeviceAttestationKey(newValue);
return Provision::Manager::GetInstance().GetStorage().SetDeviceAttestationKey(newValue);
case (int) FactoryTags::kDacCert:
ChipLogProgress(SoftwareUpdate, "Set Device Attestation Cert");
return factoryProvider.FactoryProvider::SetDeviceAttestationCert(newValue);
return Provision::Manager::GetInstance().GetStorage().SetDeviceAttestationCert(newValue);
case (int) FactoryTags::kPaiCert:
ChipLogProgress(SoftwareUpdate, "Set Product Attestionation Intermediate Cert");
return factoryProvider.FactoryProvider::SetProductAttestationIntermediateCert(newValue);
return Provision::Manager::GetInstance().GetStorage().SetProductAttestationIntermediateCert(newValue);
case (int) FactoryTags::kCdCert:
ChipLogProgress(SoftwareUpdate, "Set Certification Declaration");
return factoryProvider.FactoryProvider::SetCertificationDeclaration(newValue);
return Provision::Manager::GetInstance().GetStorage().SetCertificationDeclaration(newValue);
}

ChipLogError(DeviceLayer, "Failed to find tag %d.", tag);
Expand Down
4 changes: 2 additions & 2 deletions src/platform/silabs/multi-ota/OTAFactoryDataProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

#pragma once

#include <ProvisionManager.h>
#include <ProvisionStorage.h>
#include <lib/core/Optional.h>
#include <lib/support/ScopedBuffer.h>
#include <lib/support/Span.h>
#include <platform/silabs/multi-ota/OTATlvProcessor.h>
#include <provision/ProvisionStorage.h> // nogncheck
#include <provision/ProvisionStorageGeneric.h> // nogncheck

namespace chip {

Expand Down

0 comments on commit 66c43f6

Please sign in to comment.