|
20 | 20 | #include <optional> |
21 | 21 |
|
22 | 22 | #include <access/Privilege.h> |
23 | | -#include <app-common/zap-generated/cluster-objects.h> |
24 | | -#include <app/AttributePathParams.h> |
25 | | -#include <app/ConcreteAttributePath.h> |
26 | | -#include <app/ConcreteClusterPath.h> |
27 | | -#include <app/ConcreteCommandPath.h> |
28 | | -#include <app/data-model-provider/MetadataList.h> |
29 | | -#include <app/data-model/List.h> |
30 | 23 | #include <lib/core/DataModelTypes.h> |
31 | 24 | #include <lib/support/BitFlags.h> |
32 | | -#include <lib/support/BitMask.h> |
33 | | -#include <lib/support/Span.h> |
34 | 25 |
|
35 | 26 | namespace chip { |
36 | 27 | namespace app { |
@@ -135,65 +126,6 @@ struct DeviceTypeEntry |
135 | 126 | } |
136 | 127 | }; |
137 | 128 |
|
138 | | -/// Provides metadata information for a data model |
139 | | -/// |
140 | | -/// The data model can be viewed as a tree of endpoint/cluster/(attribute+commands+events) |
141 | | -/// where each element can be iterated through independently. |
142 | | -/// |
143 | | -/// Iteration rules: |
144 | | -/// - Invalid paths will be returned when iteration ends (IDs will be kInvalid* and in particular |
145 | | -/// mEndpointId will be kInvalidEndpointId). See `::kInvalid` constants for entries and |
146 | | -/// can use ::IsValid() to determine if the entry is valid or not. |
147 | | -/// - Global Attributes are NOT returned since they are implied |
148 | | -/// - Any internal iteration errors are just logged (callers do not handle iteration CHIP_ERROR) |
149 | | -/// - Iteration order is NOT guaranteed globally. Only the following is guaranteed: |
150 | | -/// - Complete tree iteration (e.g. when iterating an endpoint, ALL clusters of that endpoint |
151 | | -/// are returned, when iterating over a cluster, all attributes/commands are iterated over) |
152 | | -/// - uniqueness and completeness (iterate over all possible distinct values as long as no |
153 | | -/// internal structural changes occur) |
154 | | -class ProviderMetadataTree |
155 | | -{ |
156 | | -public: |
157 | | - virtual ~ProviderMetadataTree() = default; |
158 | | - |
159 | | - using SemanticTag = Clusters::Descriptor::Structs::SemanticTagStruct::Type; |
160 | | - |
161 | | - virtual CHIP_ERROR Endpoints(ListBuilder<EndpointEntry> & builder) = 0; |
162 | | - |
163 | | - virtual CHIP_ERROR SemanticTags(EndpointId endpointId, ListBuilder<SemanticTag> & builder) = 0; |
164 | | - virtual CHIP_ERROR DeviceTypes(EndpointId endpointId, ListBuilder<DeviceTypeEntry> & builder) = 0; |
165 | | - virtual CHIP_ERROR ClientClusters(EndpointId endpointId, ListBuilder<ClusterId> & builder) = 0; |
166 | | - virtual CHIP_ERROR ServerClusters(EndpointId endpointId, ListBuilder<ServerClusterEntry> & builder) = 0; |
167 | | - |
168 | | - virtual CHIP_ERROR Attributes(const ConcreteClusterPath & path, ListBuilder<AttributeEntry> & builder) = 0; |
169 | | - virtual CHIP_ERROR GeneratedCommands(const ConcreteClusterPath & path, ListBuilder<CommandId> & builder) = 0; |
170 | | - virtual CHIP_ERROR AcceptedCommands(const ConcreteClusterPath & path, ListBuilder<AcceptedCommandEntry> & builder) = 0; |
171 | | - |
172 | | - /// Workaround function to report attribute change. |
173 | | - /// |
174 | | - /// When this is invoked, the caller is expected to increment the cluster data version, and the attribute path |
175 | | - /// should be marked as `dirty` by the data model provider listener so that the reporter can notify the subscriber |
176 | | - /// of attribute changes. |
177 | | - /// This function should be invoked when attribute managed by attribute access interface is modified but not |
178 | | - /// through an actual Write interaction. |
179 | | - /// For example, if the LastNetworkingStatus attribute changes because the NetworkCommissioning driver detects a |
180 | | - /// network connection status change and calls SetLastNetworkingStatusValue(). The data model provider can recognize |
181 | | - /// this change by invoking this function at the point of change. |
182 | | - /// |
183 | | - /// This is a workaround function as we cannot notify the attribute change to the data model provider. The provider |
184 | | - /// should own its data and versions. |
185 | | - /// |
186 | | - /// TODO: We should remove this function when the AttributeAccessInterface/CommandHandlerInterface is able to report |
187 | | - /// the attribute changes. |
188 | | - virtual void Temporary_ReportAttributeChanged(const AttributePathParams & path) = 0; |
189 | | - |
190 | | - // "convenience" functions that just return the data and ignore the error |
191 | | - // This returns the builder as-is even after the error (e.g. not found would return empty data) |
192 | | - ReadOnlyBuffer<EndpointEntry> EndpointsIgnoreError(); |
193 | | - ReadOnlyBuffer<ServerClusterEntry> ServerClustersIgnoreError(EndpointId endpointId); |
194 | | - ReadOnlyBuffer<AttributeEntry> AttributesIgnoreError(const ConcreteClusterPath & path); |
195 | | -}; |
196 | | - |
197 | 129 | } // namespace DataModel |
198 | 130 | } // namespace app |
199 | 131 | } // namespace chip |
0 commit comments