diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 56ef62d03f69eb..c000a61397c105 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -2086,7 +2086,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index 61e836fce91b12..74468abeb82263 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -548,7 +548,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/door-lock-app/door-lock-common/door-lock-app.matter b/examples/door-lock-app/door-lock-common/door-lock-app.matter index 664e28863bd57c..4d591615f1ad81 100644 --- a/examples/door-lock-app/door-lock-common/door-lock-app.matter +++ b/examples/door-lock-app/door-lock-common/door-lock-app.matter @@ -776,7 +776,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index dbd2cead15f2ec..a936603de8d1a2 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1080,7 +1080,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index d885506c81fec8..170cbf2a12ed7e 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -472,7 +472,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter index 4e456f4d21ec4a..b30fe86c61fc66 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter @@ -276,7 +276,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index 8d051e15cb3334..5a07d294254216 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -382,7 +382,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index d0448ca94c4c5d..0c34c1570c6126 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -521,7 +521,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index 9274c5f3b52a06..8691295541f029 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -541,7 +541,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter index 586cd6b6327b3b..35c7dc3d71e81a 100644 --- a/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter +++ b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter @@ -437,7 +437,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index bdab9ca406dc6b..87622ccd8e6163 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -686,7 +686,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index fd946fa0639534..51b903a95ad2bf 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -1333,7 +1333,7 @@ client cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { @@ -1431,7 +1431,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index 0166afd617111e..cceeba7a179571 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1850,7 +1850,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index 1eb01c312a264d..b7fe2bc89d95b5 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -458,7 +458,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 2c5113a955b98a..ede38add11da6a 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -112,8 +112,15 @@ CHIP_ERROR OperationalCredentialsAttrAccess::ReadNOCs(EndpointId endpoint, Attri if (accessingFabricIndex == fabricInfo.GetFabricIndex()) { + ByteSpan icac; + ReturnErrorOnFailure(fabricInfo.GetNOCCert(noc.noc)); - ReturnErrorOnFailure(fabricInfo.GetICACert(noc.icac)); + ReturnErrorOnFailure(fabricInfo.GetICACert(icac)); + + if (!icac.empty()) + { + noc.icac.SetNonNull(icac); + } } ReturnErrorOnFailure(encoder.Encode(noc)); diff --git a/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml index f24ff35b33539a..a31ae9fa7974bb 100644 --- a/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml @@ -45,7 +45,7 @@ limitations under the License. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 3416858249ba43..a5418707c58cb4 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2305,7 +2305,7 @@ client cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index c750510db1111f..5f378342449ce0 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -6849,10 +6849,17 @@ void CHIPOperationalCredentialsNOCsAttributeCallback::CallbackFn( reinterpret_cast(entry_0.noc.data())); newElement_0_noc = newElement_0_nocByteArray; jobject newElement_0_icac; - jbyteArray newElement_0_icacByteArray = env->NewByteArray(static_cast(entry_0.icac.size())); - env->SetByteArrayRegion(newElement_0_icacByteArray, 0, static_cast(entry_0.icac.size()), - reinterpret_cast(entry_0.icac.data())); - newElement_0_icac = newElement_0_icacByteArray; + if (entry_0.icac.IsNull()) + { + newElement_0_icac = nullptr; + } + else + { + jbyteArray newElement_0_icacByteArray = env->NewByteArray(static_cast(entry_0.icac.Value().size())); + env->SetByteArrayRegion(newElement_0_icacByteArray, 0, static_cast(entry_0.icac.Value().size()), + reinterpret_cast(entry_0.icac.Value().data())); + newElement_0_icac = newElement_0_icacByteArray; + } jclass NOCStructStructClass; err = chip::JniReferences::GetInstance().GetClassRef( diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java index d0070debbd91c8..bbbf6488468e15 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java @@ -1175,9 +1175,10 @@ public String toString() { public static class OperationalCredentialsClusterNOCStruct { public Integer fabricIndex; public byte[] noc; - public byte[] icac; + public @Nullable byte[] icac; - public OperationalCredentialsClusterNOCStruct(Integer fabricIndex, byte[] noc, byte[] icac) { + public OperationalCredentialsClusterNOCStruct( + Integer fabricIndex, byte[] noc, @Nullable byte[] icac) { this.fabricIndex = fabricIndex; this.noc = noc; this.icac = icac; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index cab7b48c8e77d1..50ba8eb04c1f32 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -12671,12 +12671,12 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields = [ ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="noc", Tag=1, Type=bytes), - ClusterObjectFieldDescriptor(Label="icac", Tag=2, Type=bytes), + ClusterObjectFieldDescriptor(Label="icac", Tag=2, Type=typing.Union[Nullable, bytes]), ]) fabricIndex: 'uint' = 0 noc: 'bytes' = b"" - icac: 'bytes' = b"" + icac: 'typing.Union[Nullable, bytes]' = NullValue diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index f33a9878158bb0..becc6b93adf5ea 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -5037,7 +5037,11 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader newElement_0 = [CHIPOperationalCredentialsClusterNOCStruct new]; newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.noc = [NSData dataWithBytes:entry_0.noc.data() length:entry_0.noc.size()]; - newElement_0.icac = [NSData dataWithBytes:entry_0.icac.data() length:entry_0.icac.size()]; + if (entry_0.icac.IsNull()) { + newElement_0.icac = nil; + } else { + newElement_0.icac = [NSData dataWithBytes:entry_0.icac.Value().data() length:entry_0.icac.Value().size()]; + } [array_0 addObject:newElement_0]; } { // Scope for the error so we will know what it's named diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index 5d22279ff9ee56..8542fe88acbcf3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -3493,7 +3493,11 @@ newElement_0 = [CHIPOperationalCredentialsClusterNOCStruct new]; newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; newElement_0.noc = [NSData dataWithBytes:entry_0.noc.data() length:entry_0.noc.size()]; - newElement_0.icac = [NSData dataWithBytes:entry_0.icac.data() length:entry_0.icac.size()]; + if (entry_0.icac.IsNull()) { + newElement_0.icac = nil; + } else { + newElement_0.icac = [NSData dataWithBytes:entry_0.icac.Value().data() length:entry_0.icac.Value().size()]; + } [array_0 addObject:newElement_0]; } { // Scope for the error so we will know what it's named diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h index a46455eaac30ed..a0f42bf7501aa6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h @@ -252,7 +252,7 @@ NS_ASSUME_NONNULL_BEGIN @interface CHIPOperationalCredentialsClusterNOCStruct : NSObject @property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; @property (strong, nonatomic) NSData * _Nonnull noc; -@property (strong, nonatomic) NSData * _Nonnull icac; +@property (strong, nonatomic) NSData * _Nullable icac; - (instancetype)init; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm index 767f0085dffde8..dcb13b65c4413d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm @@ -506,7 +506,7 @@ - (instancetype)init _noc = [NSData data]; - _icac = [NSData data]; + _icac = nil; } return self; } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index ff579d49ed90ca..9259ea4ab393ad 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -6816,7 +6816,12 @@ new CHIPDefaultSuccessCallbackBridge( auto element_0 = (CHIPOperationalCredentialsClusterNOCStruct *) value[i_0]; listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; listHolder_0->mList[i_0].noc = [self asByteSpan:element_0.noc]; - listHolder_0->mList[i_0].icac = [self asByteSpan:element_0.icac]; + if (element_0.icac == nil) { + listHolder_0->mList[i_0].icac.SetNull(); + } else { + auto & nonNullValue_2 = listHolder_0->mList[i_0].icac.SetNonNull(); + nonNullValue_2 = [self asByteSpan:element_0.icac]; + } } cppValue = ListType_0(listHolder_0->mList, value.count); } else { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 5a63a778a195f1..ac18c3c41004e2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -14695,7 +14695,7 @@ struct Type public: chip::FabricIndex fabricIndex = static_cast(0); chip::ByteSpan noc; - chip::ByteSpan icac; + DataModel::Nullable icac; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader);