Skip to content

Commit 920ace2

Browse files
committed
Merge remote-tracking branch 'origin/camera-webrtc-server' into camera-webrtc-server
# Conflicts: # src/controller/data_model/controller-clusters.matter # src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java # src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java # src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java # src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TlsCertificateManagementClusterTLSClientCertificateDetailStruct.kt # src/controller/java/generated/java/matter/controller/cluster/structs/TlsCertificateManagementClusterTLSClientCertificateDetailStruct.kt # src/controller/python/chip/clusters/Objects.py # src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h # src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm # src/darwin/Framework/CHIP/zap-generated/MTRClusters.h # src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm # src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm # src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h # src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
2 parents 5a61d8c + 62375af commit 920ace2

35 files changed

+708
-468
lines changed

examples/energy-management-app/energy-management-common/device-energy-management/src/DEMTestEventTriggers.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ constexpr uint16_t MAX_POWER_ADJUSTMENTS = 5;
3636

3737
chip::app::Clusters::DeviceEnergyManagement::Structs::SlotStruct::Type sSlots[MAX_SLOTS];
3838
chip::app::Clusters::DeviceEnergyManagement::Structs::ForecastStruct::Type sForecastStruct;
39-
chip::app::DataModel::Nullable<chip::app::Clusters::DeviceEnergyManagement::Structs::ForecastStruct::Type> sForecast;
4039

4140
chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type sPowerAdjustments[MAX_POWER_ADJUSTMENTS];
4241
chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::Type sPowerAdjustCapabilityStruct;

scripts/setup/zap.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"mac-amd64",
99
"windows-amd64"
1010
],
11-
"tags": ["version:2@v2024.10.24-nightly.1"]
11+
"tags": ["version:2@v2025.01.10-nightly.1"]
1212
},
1313
{
1414
"_comment": "Always get the amd64 version on mac until usable arm64 zap build is available",
1515
"path": "fuchsia/third_party/zap/mac-amd64",
1616
"platforms": ["mac-arm64"],
17-
"tags": ["version:2@v2024.10.24-nightly.1"]
17+
"tags": ["version:2@v2025.01.10-nightly.1"]
1818
}
1919
]
2020
}

scripts/setup/zap.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2024.10.24-nightly
1+
v2025.01.10-nightly

scripts/tools/zap/zap_execution.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Use scripts/tools/zap/version_update.py to manage ZAP versioning as many
2424
# files may need updating for versions
2525
#
26-
MIN_ZAP_VERSION = '2024.10.24'
26+
MIN_ZAP_VERSION = '2025.1.10'
2727

2828

2929
class ZapTool:

src/app/AttributePathExpandIterator.cpp

+114-121
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,86 @@
1919
#include <app/GlobalAttributes.h>
2020
#include <lib/support/CodeUtils.h>
2121

22+
#include <optional>
23+
2224
using namespace chip::app::DataModel;
2325

2426
namespace chip {
2527
namespace app {
2628

27-
AttributePathExpandIterator::AttributePathExpandIterator(DataModel::Provider * provider,
28-
SingleLinkedListNode<AttributePathParams> * attributePath) :
29-
mDataModelProvider(provider),
30-
mpAttributePath(attributePath), mOutputPath(kInvalidEndpointId, kInvalidClusterId, kInvalidAttributeId)
29+
bool AttributePathExpandIterator::AdvanceOutputPath()
30+
{
31+
/// Output path invariants
32+
/// - kInvalid* constants are used to define "no value available (yet)" and
33+
/// iteration loop will fill the first value when such a value is seen (fixed for non-wildcard
34+
/// or iteration-based in case of wildcards).
35+
/// - Iteration of the output path is done in order: first endpoint, then cluster, then attribute.
36+
/// Processing works like:
37+
/// - Initial state is kInvalidEndpointId/kInvalidClusterId/kInvalidAttributeId
38+
/// - First loop pass fills-in endpointID, followed by clusterID, followed by attributeID
39+
/// - Whenever one level is done iterating (there is no "next") the following
40+
/// "higher path component" is updated:
41+
/// - once a valid path exists, try to advance attributeID
42+
/// - if attributeID fails to advance, try to advance clusterID (and restart attributeID)
43+
/// - if clusterID fails to advance, try to advance endpointID (and restart clusterID)
44+
/// - if endpointID fails to advance, iteration is done
45+
while (true)
46+
{
47+
if (mPosition.mOutputPath.mClusterId != kInvalidClusterId)
48+
{
49+
std::optional<AttributeId> nextAttribute = NextAttributeId();
50+
if (nextAttribute.has_value())
51+
{
52+
mPosition.mOutputPath.mAttributeId = *nextAttribute;
53+
mPosition.mOutputPath.mExpanded = mPosition.mAttributePath->mValue.IsWildcardPath();
54+
return true;
55+
}
56+
}
57+
58+
// no valid attribute, try to advance the cluster, see if a suitable one exists
59+
if (mPosition.mOutputPath.mEndpointId != kInvalidEndpointId)
60+
{
61+
std::optional<ClusterId> nextCluster = NextClusterId();
62+
if (nextCluster.has_value())
63+
{
64+
// A new cluster ID is to be processed. This sets the cluster ID to the new value and
65+
// ALSO resets the attribute ID to "invalid", to trigger an attribute set/expansion from
66+
// the beginning.
67+
mPosition.mOutputPath.mClusterId = *nextCluster;
68+
mPosition.mOutputPath.mAttributeId = kInvalidAttributeId;
69+
continue;
70+
}
71+
}
72+
73+
// No valid cluster, try advance the endpoint, see if a suitable one exists.
74+
std::optional<EndpointId> nextEndpoint = NextEndpointId();
75+
if (nextEndpoint.has_value())
76+
{
77+
// A new endpoint ID is to be processed. This sets the endpoint ID to the new value and
78+
// ALSO resets the cluster ID to "invalid", to trigger a cluster set/expansion from
79+
// the beginning.
80+
mPosition.mOutputPath.mEndpointId = *nextEndpoint;
81+
mPosition.mOutputPath.mClusterId = kInvalidClusterId;
82+
continue;
83+
}
84+
return false;
85+
}
86+
}
3187

88+
bool AttributePathExpandIterator::Next(ConcreteAttributePath & path)
3289
{
33-
mOutputPath.mExpanded = true; // this is reset in 'next' if needed
90+
while (mPosition.mAttributePath != nullptr)
91+
{
92+
if (AdvanceOutputPath())
93+
{
94+
path = mPosition.mOutputPath;
95+
return true;
96+
}
97+
mPosition.mAttributePath = mPosition.mAttributePath->mpNext;
98+
mPosition.mOutputPath = ConcreteReadAttributePath(kInvalidEndpointId, kInvalidClusterId, kInvalidAttributeId);
99+
}
34100

35-
// Make the iterator ready to emit the first valid path in the list.
36-
// TODO: the bool return value here is completely unchecked
37-
Next();
101+
return false;
38102
}
39103

40104
bool AttributePathExpandIterator::IsValidAttributeId(AttributeId attributeId)
@@ -49,40 +113,43 @@ bool AttributePathExpandIterator::IsValidAttributeId(AttributeId attributeId)
49113
break;
50114
}
51115

52-
const ConcreteAttributePath attributePath(mOutputPath.mEndpointId, mOutputPath.mClusterId, attributeId);
116+
const ConcreteAttributePath attributePath(mPosition.mOutputPath.mEndpointId, mPosition.mOutputPath.mClusterId, attributeId);
53117
return mDataModelProvider->GetAttributeInfo(attributePath).has_value();
54118
}
55119

56120
std::optional<AttributeId> AttributePathExpandIterator::NextAttributeId()
57121
{
58-
if (mOutputPath.mAttributeId == kInvalidAttributeId)
122+
if (mPosition.mOutputPath.mAttributeId == kInvalidAttributeId)
59123
{
60-
if (mpAttributePath->mValue.HasWildcardAttributeId())
124+
if (mPosition.mAttributePath->mValue.HasWildcardAttributeId())
61125
{
62-
AttributeEntry entry = mDataModelProvider->FirstAttribute(mOutputPath);
126+
AttributeEntry entry = mDataModelProvider->FirstAttribute(mPosition.mOutputPath);
63127
return entry.IsValid() //
64128
? entry.path.mAttributeId //
65129
: Clusters::Globals::Attributes::GeneratedCommandList::Id; //
66130
}
67131

68-
// We allow fixed attribute IDs if and only if they are valid:
69-
// - they may be GLOBAL attributes OR
70-
// - they are valid attributes for this cluster
71-
if (IsValidAttributeId(mpAttributePath->mValue.mAttributeId))
132+
// At this point, the attributeID is NOT a wildcard (i.e. it is fixed).
133+
//
134+
// For wildcard expansion, we validate that this is a valid attribute for the given
135+
// cluster on the given endpoint. If not a wildcard expansion, return it as-is.
136+
if (mPosition.mAttributePath->mValue.IsWildcardPath())
72137
{
73-
return mpAttributePath->mValue.mAttributeId;
138+
if (!IsValidAttributeId(mPosition.mAttributePath->mValue.mAttributeId))
139+
{
140+
return std::nullopt;
141+
}
74142
}
75-
76-
return std::nullopt;
143+
return mPosition.mAttributePath->mValue.mAttributeId;
77144
}
78145

79-
// advance the existing attribute id if it can be advanced
80-
VerifyOrReturnValue(mpAttributePath->mValue.HasWildcardAttributeId(), std::nullopt);
146+
// Advance the existing attribute id if it can be advanced.
147+
VerifyOrReturnValue(mPosition.mAttributePath->mValue.HasWildcardAttributeId(), std::nullopt);
81148

82149
// Ensure (including ordering) that GlobalAttributesNotInMetadata is reported as needed
83150
for (unsigned i = 0; i < ArraySize(GlobalAttributesNotInMetadata); i++)
84151
{
85-
if (GlobalAttributesNotInMetadata[i] != mOutputPath.mAttributeId)
152+
if (GlobalAttributesNotInMetadata[i] != mPosition.mOutputPath.mAttributeId)
86153
{
87154
continue;
88155
}
@@ -93,11 +160,12 @@ std::optional<AttributeId> AttributePathExpandIterator::NextAttributeId()
93160
return GlobalAttributesNotInMetadata[nextAttributeIndex];
94161
}
95162

96-
// reached the end of global attributes
163+
// Reached the end of global attributes. Since global attributes are
164+
// reported last, finishing global attributes means everything completed.
97165
return std::nullopt;
98166
}
99167

100-
AttributeEntry entry = mDataModelProvider->NextAttribute(mOutputPath);
168+
AttributeEntry entry = mDataModelProvider->NextAttribute(mPosition.mOutputPath);
101169
if (entry.IsValid())
102170
{
103171
return entry.path.mAttributeId;
@@ -111,130 +179,55 @@ std::optional<AttributeId> AttributePathExpandIterator::NextAttributeId()
111179
std::optional<ClusterId> AttributePathExpandIterator::NextClusterId()
112180
{
113181

114-
if (mOutputPath.mClusterId == kInvalidClusterId)
182+
if (mPosition.mOutputPath.mClusterId == kInvalidClusterId)
115183
{
116-
if (mpAttributePath->mValue.HasWildcardClusterId())
184+
if (mPosition.mAttributePath->mValue.HasWildcardClusterId())
117185
{
118-
ClusterEntry entry = mDataModelProvider->FirstServerCluster(mOutputPath.mEndpointId);
186+
ClusterEntry entry = mDataModelProvider->FirstServerCluster(mPosition.mOutputPath.mEndpointId);
119187
return entry.IsValid() ? std::make_optional(entry.path.mClusterId) : std::nullopt;
120188
}
121189

122-
// only return a cluster if it is valid
123-
const ConcreteClusterPath clusterPath(mOutputPath.mEndpointId, mpAttributePath->mValue.mClusterId);
124-
if (!mDataModelProvider->GetServerClusterInfo(clusterPath).has_value())
190+
// At this point, the clusterID is NOT a wildcard (i.e. is fixed).
191+
//
192+
// For wildcard expansion, we validate that this is a valid cluster for the endpoint.
193+
// If non-wildcard expansion, we return as-is.
194+
if (mPosition.mAttributePath->mValue.IsWildcardPath())
125195
{
126-
return std::nullopt;
196+
const ConcreteClusterPath clusterPath(mPosition.mOutputPath.mEndpointId, mPosition.mAttributePath->mValue.mClusterId);
197+
if (!mDataModelProvider->GetServerClusterInfo(clusterPath).has_value())
198+
{
199+
return std::nullopt;
200+
}
127201
}
128202

129-
return mpAttributePath->mValue.mClusterId;
203+
return mPosition.mAttributePath->mValue.mClusterId;
130204
}
131205

132-
VerifyOrReturnValue(mpAttributePath->mValue.HasWildcardClusterId(), std::nullopt);
206+
VerifyOrReturnValue(mPosition.mAttributePath->mValue.HasWildcardClusterId(), std::nullopt);
133207

134-
ClusterEntry entry = mDataModelProvider->NextServerCluster(mOutputPath);
208+
ClusterEntry entry = mDataModelProvider->NextServerCluster(mPosition.mOutputPath);
135209
return entry.IsValid() ? std::make_optional(entry.path.mClusterId) : std::nullopt;
136210
}
137211

138212
std::optional<ClusterId> AttributePathExpandIterator::NextEndpointId()
139213
{
140-
if (mOutputPath.mEndpointId == kInvalidEndpointId)
214+
if (mPosition.mOutputPath.mEndpointId == kInvalidEndpointId)
141215
{
142-
if (mpAttributePath->mValue.HasWildcardEndpointId())
216+
if (mPosition.mAttributePath->mValue.HasWildcardEndpointId())
143217
{
144218
EndpointEntry ep = mDataModelProvider->FirstEndpoint();
145219
return (ep.id != kInvalidEndpointId) ? std::make_optional(ep.id) : std::nullopt;
146220
}
147221

148-
return mpAttributePath->mValue.mEndpointId;
222+
return mPosition.mAttributePath->mValue.mEndpointId;
149223
}
150224

151-
VerifyOrReturnValue(mpAttributePath->mValue.HasWildcardEndpointId(), std::nullopt);
225+
// Expand endpoints only if it is a wildcard on the endpoint specifically.
226+
VerifyOrReturnValue(mPosition.mAttributePath->mValue.HasWildcardEndpointId(), std::nullopt);
152227

153-
EndpointEntry ep = mDataModelProvider->NextEndpoint(mOutputPath.mEndpointId);
228+
EndpointEntry ep = mDataModelProvider->NextEndpoint(mPosition.mOutputPath.mEndpointId);
154229
return (ep.id != kInvalidEndpointId) ? std::make_optional(ep.id) : std::nullopt;
155230
}
156231

157-
void AttributePathExpandIterator::ResetCurrentCluster()
158-
{
159-
// If this is a null iterator, or the attribute id of current cluster info is not a wildcard attribute id, then this function
160-
// will do nothing, since we won't be expanding the wildcard attribute ids under a cluster.
161-
VerifyOrReturn(mpAttributePath != nullptr && mpAttributePath->mValue.HasWildcardAttributeId());
162-
163-
// Reset path expansion to ask for the first attribute of the current cluster
164-
mOutputPath.mAttributeId = kInvalidAttributeId;
165-
mOutputPath.mExpanded = true; // we know this is a wildcard attribute
166-
Next();
167-
}
168-
169-
bool AttributePathExpandIterator::AdvanceOutputPath()
170-
{
171-
if (!mpAttributePath->mValue.IsWildcardPath())
172-
{
173-
if (mOutputPath.mEndpointId != kInvalidEndpointId)
174-
{
175-
return false; // cannot expand non-wildcard path
176-
}
177-
178-
mOutputPath.mEndpointId = mpAttributePath->mValue.mEndpointId;
179-
mOutputPath.mClusterId = mpAttributePath->mValue.mClusterId;
180-
mOutputPath.mAttributeId = mpAttributePath->mValue.mAttributeId;
181-
mOutputPath.mExpanded = false;
182-
return true;
183-
}
184-
185-
while (true)
186-
{
187-
if (mOutputPath.mClusterId != kInvalidClusterId)
188-
{
189-
190-
std::optional<AttributeId> nextAttribute = NextAttributeId();
191-
if (nextAttribute.has_value())
192-
{
193-
mOutputPath.mAttributeId = *nextAttribute;
194-
return true;
195-
}
196-
}
197-
198-
// no valid attribute, try to advance the cluster, see if a suitable one exists
199-
if (mOutputPath.mEndpointId != kInvalidEndpointId)
200-
{
201-
std::optional<ClusterId> nextCluster = NextClusterId();
202-
if (nextCluster.has_value())
203-
{
204-
mOutputPath.mClusterId = *nextCluster;
205-
mOutputPath.mAttributeId = kInvalidAttributeId; // restarts attributes
206-
continue;
207-
}
208-
}
209-
210-
// no valid cluster, try advance the endpoint, see if a suitable on exists
211-
std::optional<EndpointId> nextEndpoint = NextEndpointId();
212-
if (nextEndpoint.has_value())
213-
{
214-
mOutputPath.mEndpointId = *nextEndpoint;
215-
mOutputPath.mClusterId = kInvalidClusterId; // restarts clusters
216-
continue;
217-
}
218-
return false;
219-
}
220-
}
221-
222-
bool AttributePathExpandIterator::Next()
223-
{
224-
while (mpAttributePath != nullptr)
225-
{
226-
if (AdvanceOutputPath())
227-
{
228-
return true;
229-
}
230-
mpAttributePath = mpAttributePath->mpNext;
231-
mOutputPath = ConcreteReadAttributePath(kInvalidEndpointId, kInvalidClusterId, kInvalidAttributeId);
232-
mOutputPath.mExpanded = true; // this is reset to false on advancement if needed
233-
}
234-
235-
mOutputPath = ConcreteReadAttributePath();
236-
return false;
237-
}
238-
239232
} // namespace app
240233
} // namespace chip

0 commit comments

Comments
 (0)