Add missing support for returning credential data in GetCredentialStatusResponse. (#35732)
* Add missing support for returning credential data in GetCredentialStatusResponse.
* Regenerate generated code.
diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter
index 9b30603..a261fb4 100644
--- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter
+++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter
@@ -3464,6 +3464,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter
index fc6ef76..36a7822 100644
--- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter
+++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter
@@ -2301,6 +2301,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter
index 0b316c7..45e530b 100644
--- a/examples/lock-app/lock-common/lock-app.matter
+++ b/examples/lock-app/lock-common/lock-app.matter
@@ -2728,6 +2728,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/examples/lock-app/nxp/zap/lock-app.matter b/examples/lock-app/nxp/zap/lock-app.matter
index 7c39ef0..91e023d 100644
--- a/examples/lock-app/nxp/zap/lock-app.matter
+++ b/examples/lock-app/nxp/zap/lock-app.matter
@@ -2304,6 +2304,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/examples/lock-app/qpg/zap/lock.matter b/examples/lock-app/qpg/zap/lock.matter
index 303b079..1d367e9 100644
--- a/examples/lock-app/qpg/zap/lock.matter
+++ b/examples/lock-app/qpg/zap/lock.matter
@@ -2401,6 +2401,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter
index de9603d..6fcce30 100644
--- a/examples/placeholder/linux/apps/app1/config.matter
+++ b/examples/placeholder/linux/apps/app1/config.matter
@@ -4098,6 +4098,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
@@ -4749,6 +4750,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter
index 2b6528d..b2be5a5 100644
--- a/examples/placeholder/linux/apps/app2/config.matter
+++ b/examples/placeholder/linux/apps/app2/config.matter
@@ -4055,6 +4055,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
@@ -4706,6 +4707,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter
index 07baa25..eb7e569 100644
--- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter
+++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter
@@ -2939,6 +2939,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp
index 3842130..43a044d 100644
--- a/src/app/clusters/door-lock-server/door-lock-server.cpp
+++ b/src/app/clusters/door-lock-server/door-lock-server.cpp
@@ -900,6 +900,21 @@
credentialExists);
}
+namespace {
+bool IsAliroCredentialType(CredentialTypeEnum credentialType)
+{
+ switch (credentialType)
+ {
+ case CredentialTypeEnum::kAliroCredentialIssuerKey:
+ case CredentialTypeEnum::kAliroEvictableEndpointKey:
+ case CredentialTypeEnum::kAliroNonEvictableEndpointKey:
+ return true;
+ default:
+ return false;
+ }
+}
+} // anonymous namespace
+
void DoorLockServer::sendGetCredentialResponse(chip::app::CommandHandler * commandObj,
const chip::app::ConcreteCommandPath & commandPath,
CredentialTypeEnum credentialType, uint16_t credentialIndex,
@@ -921,10 +936,18 @@
{
response.lastModifiedFabricIndex.SetNonNull(credentialInfo->lastModifiedBy);
}
+ if (IsAliroCredentialType(credentialType))
+ {
+ response.credentialData.Emplace(credentialInfo->credentialData);
+ }
}
else
{
response.userIndex.SetNull();
+ if (IsAliroCredentialType(credentialType))
+ {
+ response.credentialData.Emplace(NullNullable);
+ }
}
uint16_t nextCredentialIndex = 0;
if (findOccupiedCredentialSlot(commandPath.mEndpointId, credentialType, static_cast<uint16_t>(credentialIndex + 1),
diff --git a/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml
index 8ebb31d..b25cd54 100644
--- a/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml
@@ -491,6 +491,7 @@
<arg name="CreatorFabricIndex" type="fabric_idx" isNullable="true" />
<arg name="LastModifiedFabricIndex" type="fabric_idx" isNullable="true" />
<arg name="NextCredentialIndex" type="int16u" isNullable="true" />
+ <arg name="CredentialData" type="octet_string" isNullable="true" optional="true" />
</command>
<!-- Conformance feature USR - for now optional -->
<command source="client" code="38" name="ClearCredential" mustUseTimedInvoke="true" optional="true">
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index 1ba5671..6c7748e 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -6263,6 +6263,7 @@
nullable fabric_idx creatorFabricIndex = 2;
nullable fabric_idx lastModifiedFabricIndex = 3;
nullable int16u nextCredentialIndex = 4;
+ optional nullable octet_string credentialData = 5;
}
request struct ClearCredentialRequest {
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
index 2ce04c3..bb92218 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
@@ -35125,6 +35125,8 @@
@Nullable Integer lastModifiedFabricIndex = null;
final long nextCredentialIndexFieldID = 4L;
@Nullable Integer nextCredentialIndex = null;
+ final long credentialDataFieldID = 5L;
+ @Nullable Optional<byte[]> credentialData = null;
for (StructElement element: invokeStructValue.value()) {
if (element.contextTagNum() == credentialExistsFieldID) {
if (element.value(BaseTLVType.class).type() == TLVType.Boolean) {
@@ -35151,9 +35153,14 @@
UIntType castingValue = element.value(UIntType.class);
nextCredentialIndex = castingValue.value(Integer.class);
}
+ } else if (element.contextTagNum() == credentialDataFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) {
+ ByteArrayType castingValue = element.value(ByteArrayType.class);
+ credentialData = Optional.of(castingValue.value(byte[].class));
+ }
}
}
- callback.onSuccess(credentialExists, userIndex, creatorFabricIndex, lastModifiedFabricIndex, nextCredentialIndex);
+ callback.onSuccess(credentialExists, userIndex, creatorFabricIndex, lastModifiedFabricIndex, nextCredentialIndex, credentialData);
}}, commandId, commandArgs, timedInvokeTimeoutMs);
}
@@ -35254,7 +35261,7 @@
}
public interface GetCredentialStatusResponseCallback extends BaseClusterCallback {
- void onSuccess(Boolean credentialExists, @Nullable Integer userIndex, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextCredentialIndex);
+ void onSuccess(Boolean credentialExists, @Nullable Integer userIndex, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextCredentialIndex, @Nullable Optional<byte[]> credentialData);
}
public interface LockStateAttributeCallback extends BaseAttributeCallback {
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
index 40427e6..d10ce6b 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
@@ -12382,7 +12382,7 @@
}
@Override
- public void onSuccess(Boolean credentialExists, @Nullable Integer userIndex, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextCredentialIndex) {
+ public void onSuccess(Boolean credentialExists, @Nullable Integer userIndex, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextCredentialIndex, @Nullable Optional<byte[]> credentialData) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
CommandResponseInfo credentialExistsResponseValue = new CommandResponseInfo("credentialExists", "Boolean");
@@ -12395,6 +12395,8 @@
responseValues.put(lastModifiedFabricIndexResponseValue, lastModifiedFabricIndex);
CommandResponseInfo nextCredentialIndexResponseValue = new CommandResponseInfo("nextCredentialIndex", "Integer");
responseValues.put(nextCredentialIndexResponseValue, nextCredentialIndex);
+ CommandResponseInfo credentialDataResponseValue = new CommandResponseInfo("credentialData", "Optional<byte[]>");
+ responseValues.put(credentialDataResponseValue, credentialData);
callback.onSuccess(responseValues);
}
diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt
index ff0525a..ad44768 100644
--- a/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt
+++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt
@@ -99,6 +99,7 @@
val creatorFabricIndex: UByte?,
val lastModifiedFabricIndex: UByte?,
val nextCredentialIndex: UShort?,
+ val credentialData: ByteArray?,
)
class LockStateAttribute(val value: UByte?)
@@ -1320,6 +1321,9 @@
val TAG_NEXT_CREDENTIAL_INDEX: Int = 4
var nextCredentialIndex_decoded: UShort? = null
+ val TAG_CREDENTIAL_DATA: Int = 5
+ var credentialData_decoded: ByteArray? = null
+
while (!tlvReader.isEndOfContainer()) {
val tag = tlvReader.peekElement().tag
@@ -1385,6 +1389,25 @@
null
}
}
+ }
+
+ if (tag == ContextSpecificTag(TAG_CREDENTIAL_DATA)) {
+ credentialData_decoded =
+ if (tlvReader.isNull()) {
+ tlvReader.getNull(tag)
+ null
+ } else {
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(tag)) {
+ tlvReader.getByteArray(tag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(tag)
+ null
+ }
+ }
} else {
tlvReader.skipElement()
}
@@ -1402,6 +1425,7 @@
creatorFabricIndex_decoded,
lastModifiedFabricIndex_decoded,
nextCredentialIndex_decoded,
+ credentialData_decoded,
)
}
diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py
index efefaf9..6a9e0b8 100644
--- a/src/controller/python/chip/clusters/Objects.py
+++ b/src/controller/python/chip/clusters/Objects.py
@@ -28861,6 +28861,7 @@
ClusterObjectFieldDescriptor(Label="creatorFabricIndex", Tag=2, Type=typing.Union[Nullable, uint]),
ClusterObjectFieldDescriptor(Label="lastModifiedFabricIndex", Tag=3, Type=typing.Union[Nullable, uint]),
ClusterObjectFieldDescriptor(Label="nextCredentialIndex", Tag=4, Type=typing.Union[Nullable, uint]),
+ ClusterObjectFieldDescriptor(Label="credentialData", Tag=5, Type=typing.Union[None, Nullable, bytes]),
])
credentialExists: 'bool' = False
@@ -28868,6 +28869,7 @@
creatorFabricIndex: 'typing.Union[Nullable, uint]' = NullValue
lastModifiedFabricIndex: 'typing.Union[Nullable, uint]' = NullValue
nextCredentialIndex: 'typing.Union[Nullable, uint]' = NullValue
+ credentialData: 'typing.Union[None, Nullable, bytes]' = None
@dataclass
class ClearCredential(ClusterCommand):
diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml
index 12458cd..3f65e9f 100644
--- a/src/darwin/Framework/CHIP/templates/availability.yaml
+++ b/src/darwin/Framework/CHIP/templates/availability.yaml
@@ -9803,6 +9803,10 @@
- GlobalEchoResponse
- StringEchoRequest
- StringEchoResponse
+ command fields:
+ DoorLock:
+ GetCredentialStatusResponse:
+ - credentialData
structs:
AccessControl:
# Targeting 1.4
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h
index 48e7175..7135f3d 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h
@@ -7212,6 +7212,8 @@
@property (nonatomic, copy) NSNumber * _Nullable lastModifiedFabricIndex MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1));
@property (nonatomic, copy) NSNumber * _Nullable nextCredentialIndex MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1));
+
+@property (nonatomic, copy) NSData * _Nullable credentialData MTR_PROVISIONALLY_AVAILABLE;
/**
* Controls whether the command is a timed command (using Timed Invoke).
*
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
index ce78c58..ec90ce4 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
@@ -20631,6 +20631,8 @@
_lastModifiedFabricIndex = nil;
_nextCredentialIndex = nil;
+
+ _credentialData = nil;
_timedInvokeTimeoutMs = nil;
}
return self;
@@ -20645,6 +20647,7 @@
other.creatorFabricIndex = self.creatorFabricIndex;
other.lastModifiedFabricIndex = self.lastModifiedFabricIndex;
other.nextCredentialIndex = self.nextCredentialIndex;
+ other.credentialData = self.credentialData;
other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs;
return other;
@@ -20652,7 +20655,7 @@
- (NSString *)description
{
- NSString * descriptionString = [NSString stringWithFormat:@"<%@: credentialExists:%@; userIndex:%@; creatorFabricIndex:%@; lastModifiedFabricIndex:%@; nextCredentialIndex:%@; >", NSStringFromClass([self class]), _credentialExists, _userIndex, _creatorFabricIndex, _lastModifiedFabricIndex, _nextCredentialIndex];
+ NSString * descriptionString = [NSString stringWithFormat:@"<%@: credentialExists:%@; userIndex:%@; creatorFabricIndex:%@; lastModifiedFabricIndex:%@; nextCredentialIndex:%@; credentialData:%@; >", NSStringFromClass([self class]), _credentialExists, _userIndex, _creatorFabricIndex, _lastModifiedFabricIndex, _nextCredentialIndex, [_credentialData base64EncodedStringWithOptions:0]];
return descriptionString;
}
@@ -20733,6 +20736,17 @@
self.nextCredentialIndex = [NSNumber numberWithUnsignedShort:decodableStruct.nextCredentialIndex.Value()];
}
}
+ {
+ if (decodableStruct.credentialData.HasValue()) {
+ if (decodableStruct.credentialData.Value().IsNull()) {
+ self.credentialData = nil;
+ } else {
+ self.credentialData = AsData(decodableStruct.credentialData.Value().Value());
+ }
+ } else {
+ self.credentialData = nil;
+ }
+ }
return CHIP_NO_ERROR;
}
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
index 00e3201..3029e31 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
@@ -19400,6 +19400,7 @@
encoder.Encode(to_underlying(Fields::kCreatorFabricIndex), creatorFabricIndex);
encoder.Encode(to_underlying(Fields::kLastModifiedFabricIndex), lastModifiedFabricIndex);
encoder.Encode(to_underlying(Fields::kNextCredentialIndex), nextCredentialIndex);
+ encoder.Encode(to_underlying(Fields::kCredentialData), credentialData);
return encoder.Finalize();
}
@@ -19437,6 +19438,10 @@
{
err = DataModel::Decode(reader, nextCredentialIndex);
}
+ else if (__context_tag == to_underlying(Fields::kCredentialData))
+ {
+ err = DataModel::Decode(reader, credentialData);
+ }
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 f8847a3..16042f9 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
@@ -26208,6 +26208,7 @@
kCreatorFabricIndex = 2,
kLastModifiedFabricIndex = 3,
kNextCredentialIndex = 4,
+ kCredentialData = 5,
};
struct Type
@@ -26222,6 +26223,7 @@
DataModel::Nullable<chip::FabricIndex> creatorFabricIndex;
DataModel::Nullable<chip::FabricIndex> lastModifiedFabricIndex;
DataModel::Nullable<uint16_t> nextCredentialIndex;
+ Optional<DataModel::Nullable<chip::ByteSpan>> credentialData;
CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
@@ -26241,6 +26243,7 @@
DataModel::Nullable<chip::FabricIndex> creatorFabricIndex;
DataModel::Nullable<chip::FabricIndex> lastModifiedFabricIndex;
DataModel::Nullable<uint16_t> nextCredentialIndex;
+ Optional<DataModel::Nullable<chip::ByteSpan>> credentialData;
CHIP_ERROR Decode(TLV::TLVReader & reader);
};
}; // namespace GetCredentialStatusResponse
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
index e51e3ea..05c1033 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
+++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
@@ -8560,6 +8560,7 @@
ReturnErrorOnFailure(DataModelLogger::LogValue("creatorFabricIndex", indent + 1, value.creatorFabricIndex));
ReturnErrorOnFailure(DataModelLogger::LogValue("lastModifiedFabricIndex", indent + 1, value.lastModifiedFabricIndex));
ReturnErrorOnFailure(DataModelLogger::LogValue("nextCredentialIndex", indent + 1, value.nextCredentialIndex));
+ ReturnErrorOnFailure(DataModelLogger::LogValue("credentialData", indent + 1, value.credentialData));
DataModelLogger::LogString(indent, "}");
return CHIP_NO_ERROR;
}