| /* |
| * Copyright (c) 2021-2025 Project CHIP Authors |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| #pragma once |
| |
| #include <app/ConcreteAttributePath.h> |
| #include <lib/support/Span.h> |
| |
| namespace chip { |
| namespace app { |
| |
| /** |
| * Interface for persisting attribute values. |
| * |
| * COMPATIBILITY NOTE: |
| * - This generally is assumed to write under a different key space from |
| * SafeAttributePersistenceProvider. |
| */ |
| class AttributePersistenceProvider |
| { |
| public: |
| virtual ~AttributePersistenceProvider() = default; |
| AttributePersistenceProvider() = default; |
| |
| /** |
| * Write an attribute value from the attribute store (i.e. not a struct or |
| * list) to non-volatile memory. |
| * |
| * @param [in] aPath the attribute path for the data being written. |
| * @param [in] aValue the data to write. |
| */ |
| virtual CHIP_ERROR WriteValue(const ConcreteAttributePath & aPath, const ByteSpan & aValue) = 0; |
| |
| /** |
| * Read an attribute value from non-volatile memory. |
| * |
| * @param [in] aPath the attribute path for the data being persisted. |
| * @param [in,out] aValue where to place the data. |
| */ |
| virtual CHIP_ERROR ReadValue(const ConcreteAttributePath & aPath, MutableByteSpan & aValue) = 0; |
| }; |
| |
| } // namespace app |
| } // namespace chip |