Skip to content

Commit a56dfc8

Browse files
committed
Address review comments
1 parent ab82b58 commit a56dfc8

File tree

12 files changed

+171
-5
lines changed

12 files changed

+171
-5
lines changed

src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ limitations under the License.
3131
<server init="false" tick="false">true</server>
3232
<description>Supports the ability for clients to request the commissioning of themselves or other nodes onto a fabric which the cluster server can commission onto.</description>
3333

34-
<attribute side="server" code="0x0000" define="SUPPORTED_DEVICE_CATEGORIES" type="SupportedDeviceCategoryBitmap" default="0" writable="false" optional="false">SupportedDeviceCategories</attribute>
34+
<!-- cluster revision -->
35+
<globalAttribute side="either" code="0xFFFD" value="1"/>
36+
37+
<attribute side="server" code="0x0000" define="SUPPORTED_DEVICE_CATEGORIES" type="SupportedDeviceCategoryBitmap" default="0" writable="true" optional="false">SupportedDeviceCategories</attribute>
3538

3639
<command source="client" code="0x00" name="RequestCommissioningApproval" optional="false">
3740
<description>This command is sent by a client to request approval for a future CommissionNode call.</description>

src/controller/data_model/controller-clusters.matter

+2-2
Original file line numberDiff line numberDiff line change
@@ -9136,7 +9136,7 @@ provisional cluster ContentAppObserver = 1296 {
91369136

91379137
/** Supports the ability for clients to request the commissioning of themselves or other nodes onto a fabric which the cluster server can commission onto. */
91389138
cluster CommissionerControl = 1873 {
9139-
revision 1; // NOTE: Default/not specifically set
9139+
revision 1;
91409140

91419141
bitmap SupportedDeviceCategoryBitmap : bitmap32 {
91429142
kFabricSynchronization = 0x1;
@@ -9148,7 +9148,7 @@ cluster CommissionerControl = 1873 {
91489148
enum8 statusCode = 2;
91499149
}
91509150

9151-
readonly attribute SupportedDeviceCategoryBitmap supportedDeviceCategories = 0;
9151+
attribute SupportedDeviceCategoryBitmap supportedDeviceCategories = 0;
91529152
readonly attribute command_id generatedCommandList[] = 65528;
91539153
readonly attribute command_id acceptedCommandList[] = 65529;
91549154
readonly attribute event_id eventList[] = 65530;

src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java

+9
Original file line numberDiff line numberDiff line change
@@ -59903,6 +59903,15 @@ public void onSuccess(byte[] tlv) {
5990359903
}, SUPPORTED_DEVICE_CATEGORIES_ATTRIBUTE_ID, true);
5990459904
}
5990559905

59906+
public void writeSupportedDeviceCategoriesAttribute(DefaultClusterCallback callback, Long value) {
59907+
writeSupportedDeviceCategoriesAttribute(callback, value, 0);
59908+
}
59909+
59910+
public void writeSupportedDeviceCategoriesAttribute(DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) {
59911+
BaseTLVType tlvValue = new UIntType(value);
59912+
writeAttribute(new WriteAttributesCallbackImpl(callback), SUPPORTED_DEVICE_CATEGORIES_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
59913+
}
59914+
5990659915
public void subscribeSupportedDeviceCategoriesAttribute(
5990759916
LongAttributeCallback callback, int minInterval, int maxInterval) {
5990859917
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_DEVICE_CATEGORIES_ATTRIBUTE_ID);

src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java

+22
Original file line numberDiff line numberDiff line change
@@ -3717,6 +3717,28 @@ public Map<String, Map<String, InteractionInfo>> getWriteAttributeMap() {
37173717
Map<String, InteractionInfo> writeContentAppObserverInteractionInfo = new LinkedHashMap<>();
37183718
writeAttributeMap.put("contentAppObserver", writeContentAppObserverInteractionInfo);
37193719
Map<String, InteractionInfo> writeCommissionerControlInteractionInfo = new LinkedHashMap<>();
3720+
Map<String, CommandParameterInfo> writeCommissionerControlSupportedDeviceCategoriesCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
3721+
CommandParameterInfo commissionerControlsupportedDeviceCategoriesCommandParameterInfo =
3722+
new CommandParameterInfo(
3723+
"value",
3724+
Long.class,
3725+
Long.class
3726+
);
3727+
writeCommissionerControlSupportedDeviceCategoriesCommandParams.put(
3728+
"value",
3729+
commissionerControlsupportedDeviceCategoriesCommandParameterInfo
3730+
);
3731+
InteractionInfo writeCommissionerControlSupportedDeviceCategoriesAttributeInteractionInfo = new InteractionInfo(
3732+
(cluster, callback, commandArguments) -> {
3733+
((ChipClusters.CommissionerControlCluster) cluster).writeSupportedDeviceCategoriesAttribute(
3734+
(DefaultClusterCallback) callback,
3735+
(Long) commandArguments.get("value")
3736+
);
3737+
},
3738+
() -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(),
3739+
writeCommissionerControlSupportedDeviceCategoriesCommandParams
3740+
);
3741+
writeCommissionerControlInteractionInfo.put("writeSupportedDeviceCategoriesAttribute", writeCommissionerControlSupportedDeviceCategoriesAttributeInteractionInfo);
37203742
writeAttributeMap.put("commissionerControl", writeCommissionerControlInteractionInfo);
37213743
Map<String, InteractionInfo> writeElectricalMeasurementInteractionInfo = new LinkedHashMap<>();
37223744
Map<String, CommandParameterInfo> writeElectricalMeasurementAverageRmsVoltageMeasurementPeriodCommandParams = new LinkedHashMap<String, CommandParameterInfo>();

src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt

+46
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ import matter.controller.SubscribeRequest
3131
import matter.controller.SubscriptionState
3232
import matter.controller.UIntSubscriptionState
3333
import matter.controller.UShortSubscriptionState
34+
import matter.controller.WriteRequest
35+
import matter.controller.WriteRequests
36+
import matter.controller.WriteResponse
3437
import matter.controller.cluster.structs.*
3538
import matter.controller.model.AttributePath
3639
import matter.controller.model.CommandPath
@@ -267,6 +270,49 @@ class CommissionerControlCluster(
267270
return decodedValue
268271
}
269272

273+
suspend fun writeSupportedDeviceCategoriesAttribute(
274+
value: UInt,
275+
timedWriteTimeout: Duration? = null,
276+
) {
277+
val ATTRIBUTE_ID: UInt = 0u
278+
279+
val tlvWriter = TlvWriter()
280+
tlvWriter.put(AnonymousTag, value)
281+
282+
val writeRequests: WriteRequests =
283+
WriteRequests(
284+
requests =
285+
listOf(
286+
WriteRequest(
287+
attributePath =
288+
AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID),
289+
tlvPayload = tlvWriter.getEncoded(),
290+
)
291+
),
292+
timedRequest = timedWriteTimeout,
293+
)
294+
295+
val response: WriteResponse = controller.write(writeRequests)
296+
297+
when (response) {
298+
is WriteResponse.Success -> {
299+
logger.log(Level.FINE, "Write command succeeded")
300+
}
301+
is WriteResponse.PartialWriteFailure -> {
302+
val aggregatedErrorMessage =
303+
response.failures.joinToString("\n") { failure ->
304+
"Error at ${failure.attributePath}: ${failure.ex.message}"
305+
}
306+
307+
response.failures.forEach { failure ->
308+
logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}")
309+
}
310+
311+
throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage")
312+
}
313+
}
314+
}
315+
270316
suspend fun subscribeSupportedDeviceCategoriesAttribute(
271317
minInterval: Int,
272318
maxInterval: Int,

src/controller/python/chip/clusters/CHIPClusters.py

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRClusters.h

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zzz_generated/chip-tool/zap-generated/cluster/Commands.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h

+42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)