Skip to content

Commit

Permalink
Implemented and tested storage by index in the scene table
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs authored and pull[bot] committed Aug 28, 2023
1 parent 77944fb commit 5254833
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 196 deletions.
2 changes: 1 addition & 1 deletion src/app/clusters/scenes/ExtensionFieldsSetsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ CHIP_ERROR ExtensionFieldsSetsImpl::insertField(ExtensionFieldsSet & field)
}
else
{
return CHIP_ERROR_BUFFER_TOO_SMALL;
return CHIP_ERROR_INVALID_LIST_LENGTH;
}
}

Expand Down
16 changes: 9 additions & 7 deletions src/app/clusters/scenes/SceneTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SceneTable
static constexpr size_t kIteratorsMax = CHIP_CONFIG_MAX_GROUP_CONCURRENT_ITERATORS;
static constexpr size_t kSceneNameMax = CHIP_CONFIG_SCENES_CLUSTER_MAXIMUM_NAME_LENGTH;
static constexpr uint8_t kMaxScenePerFabric = CHIP_CONFIG_SCENES_MAX_PER_FABRIC;

/// @brief struct used to identify a scene in storage by 3 ids, endpoint, group and scene
struct SceneStorageId
{
Expand Down Expand Up @@ -246,19 +247,20 @@ class SceneTable

SceneTable(){};

virtual ~SceneTable() = default;

// Not copyable
SceneTable(const SceneTable &) = delete;
SceneTable & operator=(const SceneTable &) = delete;

virtual CHIP_ERROR Init(PersistentStorageDelegate * storage) = 0;
virtual ~SceneTable() = default;

// Not copyable
SceneTable(const SceneTable &) = delete;
SceneTable & operator=(const SceneTable &) = delete;

virtual CHIP_ERROR Init(PersistentStorageDelegate * storage) = 0;
virtual void Finish() = 0;

// Data
virtual CHIP_ERROR SetSceneTableEntry(FabricIndex fabric_index, const SceneTableEntry & entry) = 0;
virtual CHIP_ERROR GetSceneTableEntry(FabricIndex fabric_index, SceneStorageId scene_id, SceneTableEntry & entry) = 0;
virtual CHIP_ERROR RemoveSceneTableEntry(FabricIndex fabric_index, SceneStorageId scene_id) = 0;
virtual CHIP_ERROR RemoveSceneTableEntryAtPosition(FabricIndex fabric_index, SceneIndex scened_idx) = 0;

// Iterators
using SceneEntryIterator = CommonIterator<SceneTableEntry>;
Expand Down
Loading

0 comments on commit 5254833

Please sign in to comment.