diff --git a/src/platform/silabs/provision/ProvisionManager.h b/src/platform/silabs/provision/ProvisionManager.h index c73e920c34..16e4592ce1 100644 --- a/src/platform/silabs/provision/ProvisionManager.h +++ b/src/platform/silabs/provision/ProvisionManager.h @@ -29,13 +29,6 @@ namespace Provision { class Manager { public: - Manager() : -#ifdef SILABS_PROVISION_PROTOCOL_V1 - mProtocol1(mStore), -#endif - mProtocol2(mStore) - {} - CHIP_ERROR Init(); bool Step(); bool IsProvisionRequired(); diff --git a/src/platform/silabs/provision/ProvisionProtocol.h b/src/platform/silabs/provision/ProvisionProtocol.h index 03182b59af..7f986217bf 100644 --- a/src/platform/silabs/provision/ProvisionProtocol.h +++ b/src/platform/silabs/provision/ProvisionProtocol.h @@ -37,12 +37,8 @@ class Protocol /** * Must hold the header plus complete argument value */ - Protocol(Storage & store) : mStore(store) {} virtual ~Protocol() = default; virtual bool Execute(ByteSpan & request, MutableByteSpan & response) = 0; - -protected: - Storage & mStore; }; //------------------------------------------------------------------------------ @@ -55,15 +51,14 @@ class Protocol1 : public Protocol public: static constexpr size_t kVersion = 1; - Protocol1(Storage & store) : Protocol(store) {} - virtual bool Execute(ByteSpan & request, MutableByteSpan & response); + virtual bool Execute(Storage * store, ByteSpan & request, MutableByteSpan & response); private: - CHIP_ERROR Init(Encoding::Buffer & in, Encoding::Buffer & out); - CHIP_ERROR GenerateCSR(Encoding::Buffer & in, Encoding::Buffer & out); - CHIP_ERROR Import(Encoding::Buffer & in, Encoding::Buffer & out); - CHIP_ERROR Setup(Encoding::Buffer & in, Encoding::Buffer & out); - CHIP_ERROR Read(Encoding::Buffer & in, Encoding::Buffer & out); + CHIP_ERROR Init(Storage * store, Encoding::Buffer & in, Encoding::Buffer & out); + CHIP_ERROR GenerateCSR(Storage * store, Encoding::Buffer & in, Encoding::Buffer & out); + CHIP_ERROR Import(Storage * store, Encoding::Buffer & in, Encoding::Buffer & out); + CHIP_ERROR Setup(Storage * store, Encoding::Buffer & in, Encoding::Buffer & out); + CHIP_ERROR Read(Storage * store, Encoding::Buffer & in, Encoding::Buffer & out); }; #endif // SILABS_PROVISION_PROTOCOL_V1 @@ -97,8 +92,7 @@ class Protocol2 : public Protocol static constexpr size_t kResponseHeaderSize = 8; static_assert(kPackageSizeMax > (kResponseHeaderSize + kChecksumSize)); - Protocol2(Storage & store) : Protocol(store) {} - virtual bool Execute(ByteSpan & request, MutableByteSpan & response); + virtual bool Execute(Storage * store, ByteSpan & request, MutableByteSpan & response); }; } // namespace Provision diff --git a/src/platform/silabs/provision/ProvisionStorage.h b/src/platform/silabs/provision/ProvisionStorage.h index b7123a7369..c710f8cb09 100644 --- a/src/platform/silabs/provision/ProvisionStorage.h +++ b/src/platform/silabs/provision/ProvisionStorage.h @@ -247,7 +247,7 @@ struct Storage : public GenericStorage, #endif // SL_MATTER_TEST_EVENT_TRIGGER_ENABLED void SetBufferSize(size_t size) { mBufferSize = size > 0 ? size : kArgumentSizeMax; } - size_t GetBufferSize() { return mBufferSize; } + size_t GetBufferSize() { return mBufferSize > 0 ? mBufferSize : kArgumentSizeMax; } private: // Generic Interface