Skip to content

Commit

Permalink
Add missing support for returning credential data in GetCredentialSta…
Browse files Browse the repository at this point in the history
…tusResponse.
  • Loading branch information
bzbarsky-apple committed Sep 23, 2024
1 parent 8750c55 commit d653225
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,21 @@ void DoorLockServer::getCredentialStatusCommandHandler(chip::app::CommandHandler
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,
Expand All @@ -921,10 +936,18 @@ void DoorLockServer::sendGetCredentialResponse(chip::app::CommandHandler * comma
{
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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ limitations under the License.
<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">
Expand Down
4 changes: 4 additions & 0 deletions src/darwin/Framework/CHIP/templates/availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9801,6 +9801,10 @@
- GlobalEchoResponse
- StringEchoRequest
- StringEchoResponse
command fields:
DoorLock:
GetCredentialStatusResponse:
- credentialData
structs:
AccessControl:
# Targeting 1.4
Expand Down

0 comments on commit d653225

Please sign in to comment.