Skip to content

Commit 9351279

Browse files
rochaferraztehampsonandy31415
authored andcommitted
YAML update to BRBINFO, ProductId (project-chip#34513)
* Bridged Device Information Cluster, Attribute ProductID test reflects marking as O, not X * Update src/app/tests/suites/certification/Test_TC_BRBINFO_2_1.yaml Co-authored-by: Terence Hampson <thampson@google.com> * corrected pics * corrected pics * WIP Bridged ICD, commissioning to both fabrics * wip testing sending KeepActive * update to bridged-device-basic-information.xml and zap generated files * removed unrelated file --------- Co-authored-by: Terence Hampson <thampson@google.com> Co-authored-by: Andrei Litvin <andy314@gmail.com>
1 parent 12d0123 commit 9351279

File tree

28 files changed

+423
-14
lines changed

28 files changed

+423
-14
lines changed

examples/placeholder/linux/apps/app1/config.matter

+1
Original file line numberDiff line numberDiff line change
@@ -2476,6 +2476,7 @@ cluster BridgedDeviceBasicInformation = 57 {
24762476
readonly attribute optional char_string<32> vendorName = 1;
24772477
readonly attribute optional vendor_id vendorID = 2;
24782478
readonly attribute optional char_string<32> productName = 3;
2479+
readonly attribute optional int16u productID = 4;
24792480
attribute optional char_string<32> nodeLabel = 5;
24802481
readonly attribute optional int16u hardwareVersion = 7;
24812482
readonly attribute optional char_string<64> hardwareVersionString = 8;

examples/placeholder/linux/apps/app2/config.matter

+1
Original file line numberDiff line numberDiff line change
@@ -2433,6 +2433,7 @@ cluster BridgedDeviceBasicInformation = 57 {
24332433
readonly attribute optional char_string<32> vendorName = 1;
24342434
readonly attribute optional vendor_id vendorID = 2;
24352435
readonly attribute optional char_string<32> productName = 3;
2436+
readonly attribute optional int16u productID = 4;
24362437
attribute optional char_string<32> nodeLabel = 5;
24372438
readonly attribute optional int16u hardwareVersion = 7;
24382439
readonly attribute optional char_string<64> hardwareVersionString = 8;

src/app/tests/suites/certification/Test_TC_BRBINFO_2_1.yaml

+8-14
Original file line numberDiff line numberDiff line change
@@ -140,21 +140,15 @@ tests:
140140
response:
141141
value: ProductNameValue
142142

143-
- label:
144-
"Step 14: TH reads attribute ID 4 from the DUT (matches in ID to
145-
ProductID in the parent cluster, but is absent on the
146-
BridgedDeviceBasicInformation cluster)."
147-
PICS: BRBINFO.S
148-
cluster: "AnyCommands"
149-
command: "ReadById"
150-
arguments:
151-
values:
152-
- name: "ClusterId"
153-
value: BRBINFO.ClusterId
154-
- name: "AttributeId"
155-
value: 0x0004
143+
- label: "Step 14: TH reads ProductID from the DUT"
144+
PICS: BRBINFO.S.A0004
145+
command: "readAttribute"
146+
attribute: "ProductID"
156147
response:
157-
error: UNSUPPORTED_ATTRIBUTE
148+
constraints:
149+
type: int16u
150+
minValue: 1
151+
maxValue: 65534
158152

159153
- label: "Step 17: TH reads NodeLabel from the DUT"
160154
PICS: BRBINFO.S.A0005

src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ limitations under the License.
8080
<attribute side="server" code="1" define="VENDOR_NAME" type="char_string" length="32" optional="true">VendorName</attribute>
8181
<attribute side="server" code="2" define="VENDOR_ID" type="vendor_id" optional="true">VendorID</attribute>
8282
<attribute side="server" code="3" define="PRODUCT_NAME" type="char_string" length="32" optional="true">ProductName</attribute>
83+
<attribute side="server" code="4" define="PRODUCT_ID" type="int16u" optional="true">ProductID</attribute>
8384
<attribute side="server" code="5" define="NODE_LABEL" type="char_string" length="32" default="" writable="true" optional="true">NodeLabel</attribute>
8485
<attribute side="server" code="7" define="HARDWARE_VERSION" type="int16u" default="0" optional="true">HardwareVersion</attribute>
8586
<attribute side="server" code="8" define="HARDWARE_VERSION_STRING" type="char_string" minLength="1" length="64" optional="true">HardwareVersionString</attribute>

src/controller/data_model/controller-clusters.matter

+1
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,7 @@ cluster BridgedDeviceBasicInformation = 57 {
23592359
readonly attribute optional char_string<32> vendorName = 1;
23602360
readonly attribute optional vendor_id vendorID = 2;
23612361
readonly attribute optional char_string<32> productName = 3;
2362+
readonly attribute optional int16u productID = 4;
23622363
attribute optional char_string<32> nodeLabel = 5;
23632364
readonly attribute optional int16u hardwareVersion = 7;
23642365
readonly attribute optional char_string<64> hardwareVersionString = 8;

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

+27
Original file line numberDiff line numberDiff line change
@@ -15166,6 +15166,7 @@ public static class BridgedDeviceBasicInformationCluster extends BaseChipCluster
1516615166
private static final long VENDOR_NAME_ATTRIBUTE_ID = 1L;
1516715167
private static final long VENDOR_I_D_ATTRIBUTE_ID = 2L;
1516815168
private static final long PRODUCT_NAME_ATTRIBUTE_ID = 3L;
15169+
private static final long PRODUCT_I_D_ATTRIBUTE_ID = 4L;
1516915170
private static final long NODE_LABEL_ATTRIBUTE_ID = 5L;
1517015171
private static final long HARDWARE_VERSION_ATTRIBUTE_ID = 7L;
1517115172
private static final long HARDWARE_VERSION_STRING_ATTRIBUTE_ID = 8L;
@@ -15314,6 +15315,32 @@ public void onSuccess(byte[] tlv) {
1531415315
}, PRODUCT_NAME_ATTRIBUTE_ID, minInterval, maxInterval);
1531515316
}
1531615317

15318+
public void readProductIDAttribute(
15319+
IntegerAttributeCallback callback) {
15320+
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID);
15321+
15322+
readAttribute(new ReportCallbackImpl(callback, path) {
15323+
@Override
15324+
public void onSuccess(byte[] tlv) {
15325+
Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
15326+
callback.onSuccess(value);
15327+
}
15328+
}, PRODUCT_I_D_ATTRIBUTE_ID, true);
15329+
}
15330+
15331+
public void subscribeProductIDAttribute(
15332+
IntegerAttributeCallback callback, int minInterval, int maxInterval) {
15333+
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID);
15334+
15335+
subscribeAttribute(new ReportCallbackImpl(callback, path) {
15336+
@Override
15337+
public void onSuccess(byte[] tlv) {
15338+
Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
15339+
callback.onSuccess(value);
15340+
}
15341+
}, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval);
15342+
}
15343+
1531715344
public void readNodeLabelAttribute(
1531815345
CharStringAttributeCallback callback) {
1531915346
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NODE_LABEL_ATTRIBUTE_ID);

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

+1
Original file line numberDiff line numberDiff line change
@@ -4460,6 +4460,7 @@ public enum Attribute {
44604460
VendorName(1L),
44614461
VendorID(2L),
44624462
ProductName(3L),
4463+
ProductID(4L),
44634464
NodeLabel(5L),
44644465
HardwareVersion(7L),
44654466
HardwareVersionString(8L),

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

+11
Original file line numberDiff line numberDiff line change
@@ -4659,6 +4659,17 @@ private static Map<String, InteractionInfo> readBridgedDeviceBasicInformationInt
46594659
readBridgedDeviceBasicInformationProductNameCommandParams
46604660
);
46614661
result.put("readProductNameAttribute", readBridgedDeviceBasicInformationProductNameAttributeInteractionInfo);
4662+
Map<String, CommandParameterInfo> readBridgedDeviceBasicInformationProductIDCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
4663+
InteractionInfo readBridgedDeviceBasicInformationProductIDAttributeInteractionInfo = new InteractionInfo(
4664+
(cluster, callback, commandArguments) -> {
4665+
((ChipClusters.BridgedDeviceBasicInformationCluster) cluster).readProductIDAttribute(
4666+
(ChipClusters.IntegerAttributeCallback) callback
4667+
);
4668+
},
4669+
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
4670+
readBridgedDeviceBasicInformationProductIDCommandParams
4671+
);
4672+
result.put("readProductIDAttribute", readBridgedDeviceBasicInformationProductIDAttributeInteractionInfo);
46624673
Map<String, CommandParameterInfo> readBridgedDeviceBasicInformationNodeLabelCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
46634674
InteractionInfo readBridgedDeviceBasicInformationNodeLabelAttributeInteractionInfo = new InteractionInfo(
46644675
(cluster, callback, commandArguments) -> {

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

+91
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,97 @@ class BridgedDeviceBasicInformationCluster(
395395
}
396396
}
397397

398+
suspend fun readProductIDAttribute(): UShort? {
399+
val ATTRIBUTE_ID: UInt = 4u
400+
401+
val attributePath =
402+
AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
403+
404+
val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
405+
406+
val response = controller.read(readRequest)
407+
408+
if (response.successes.isEmpty()) {
409+
logger.log(Level.WARNING, "Read command failed")
410+
throw IllegalStateException("Read command failed with failures: ${response.failures}")
411+
}
412+
413+
logger.log(Level.FINE, "Read command succeeded")
414+
415+
val attributeData =
416+
response.successes.filterIsInstance<ReadData.Attribute>().firstOrNull {
417+
it.path.attributeId == ATTRIBUTE_ID
418+
}
419+
420+
requireNotNull(attributeData) { "Productid attribute not found in response" }
421+
422+
// Decode the TLV data into the appropriate type
423+
val tlvReader = TlvReader(attributeData.data)
424+
val decodedValue: UShort? =
425+
if (tlvReader.isNextTag(AnonymousTag)) {
426+
tlvReader.getUShort(AnonymousTag)
427+
} else {
428+
null
429+
}
430+
431+
return decodedValue
432+
}
433+
434+
suspend fun subscribeProductIDAttribute(
435+
minInterval: Int,
436+
maxInterval: Int,
437+
): Flow<UShortSubscriptionState> {
438+
val ATTRIBUTE_ID: UInt = 4u
439+
val attributePaths =
440+
listOf(
441+
AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
442+
)
443+
444+
val subscribeRequest: SubscribeRequest =
445+
SubscribeRequest(
446+
eventPaths = emptyList(),
447+
attributePaths = attributePaths,
448+
minInterval = Duration.ofSeconds(minInterval.toLong()),
449+
maxInterval = Duration.ofSeconds(maxInterval.toLong()),
450+
)
451+
452+
return controller.subscribe(subscribeRequest).transform { subscriptionState ->
453+
when (subscriptionState) {
454+
is SubscriptionState.SubscriptionErrorNotification -> {
455+
emit(
456+
UShortSubscriptionState.Error(
457+
Exception(
458+
"Subscription terminated with error code: ${subscriptionState.terminationCause}"
459+
)
460+
)
461+
)
462+
}
463+
is SubscriptionState.NodeStateUpdate -> {
464+
val attributeData =
465+
subscriptionState.updateState.successes
466+
.filterIsInstance<ReadData.Attribute>()
467+
.firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
468+
469+
requireNotNull(attributeData) { "Productid attribute not found in Node State update" }
470+
471+
// Decode the TLV data into the appropriate type
472+
val tlvReader = TlvReader(attributeData.data)
473+
val decodedValue: UShort? =
474+
if (tlvReader.isNextTag(AnonymousTag)) {
475+
tlvReader.getUShort(AnonymousTag)
476+
} else {
477+
null
478+
}
479+
480+
decodedValue?.let { emit(UShortSubscriptionState.Success(it)) }
481+
}
482+
SubscriptionState.SubscriptionEstablished -> {
483+
emit(UShortSubscriptionState.SubscriptionEstablished)
484+
}
485+
}
486+
}
487+
}
488+
398489
suspend fun readNodeLabelAttribute(): String? {
399490
val ATTRIBUTE_ID: UInt = 5u
400491

src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp

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

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

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

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

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

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

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

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

+11
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

+6
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

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

0 commit comments

Comments
 (0)