Skip to content

Commit d653225

Browse files
Add missing support for returning credential data in GetCredentialStatusResponse.
1 parent 8750c55 commit d653225

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

src/app/clusters/door-lock-server/door-lock-server.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,21 @@ void DoorLockServer::getCredentialStatusCommandHandler(chip::app::CommandHandler
900900
credentialExists);
901901
}
902902

903+
namespace {
904+
bool IsAliroCredentialType(CredentialTypeEnum credentialType)
905+
{
906+
switch (credentialType)
907+
{
908+
case CredentialTypeEnum::kAliroCredentialIssuerKey:
909+
case CredentialTypeEnum::kAliroEvictableEndpointKey:
910+
case CredentialTypeEnum::kAliroNonEvictableEndpointKey:
911+
return true;
912+
default:
913+
return false;
914+
}
915+
}
916+
} // anonymous namespace
917+
903918
void DoorLockServer::sendGetCredentialResponse(chip::app::CommandHandler * commandObj,
904919
const chip::app::ConcreteCommandPath & commandPath,
905920
CredentialTypeEnum credentialType, uint16_t credentialIndex,
@@ -921,10 +936,18 @@ void DoorLockServer::sendGetCredentialResponse(chip::app::CommandHandler * comma
921936
{
922937
response.lastModifiedFabricIndex.SetNonNull(credentialInfo->lastModifiedBy);
923938
}
939+
if (IsAliroCredentialType(credentialType))
940+
{
941+
response.credentialData.Emplace(credentialInfo->credentialData);
942+
}
924943
}
925944
else
926945
{
927946
response.userIndex.SetNull();
947+
if (IsAliroCredentialType(credentialType))
948+
{
949+
response.credentialData.Emplace(NullNullable);
950+
}
928951
}
929952
uint16_t nextCredentialIndex = 0;
930953
if (findOccupiedCredentialSlot(commandPath.mEndpointId, credentialType, static_cast<uint16_t>(credentialIndex + 1),

src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml

+1
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ limitations under the License.
491491
<arg name="CreatorFabricIndex" type="fabric_idx" isNullable="true" />
492492
<arg name="LastModifiedFabricIndex" type="fabric_idx" isNullable="true" />
493493
<arg name="NextCredentialIndex" type="int16u" isNullable="true" />
494+
<arg name="CredentialData" type="octet_string" isNullable="true" optional="true" />
494495
</command>
495496
<!-- Conformance feature USR - for now optional -->
496497
<command source="client" code="38" name="ClearCredential" mustUseTimedInvoke="true" optional="true">

src/darwin/Framework/CHIP/templates/availability.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -9801,6 +9801,10 @@
98019801
- GlobalEchoResponse
98029802
- StringEchoRequest
98039803
- StringEchoResponse
9804+
command fields:
9805+
DoorLock:
9806+
GetCredentialStatusResponse:
9807+
- credentialData
98049808
structs:
98059809
AccessControl:
98069810
# Targeting 1.4

0 commit comments

Comments
 (0)