Skip to content

Commit 2be36d7

Browse files
bzbarsky-appleaustina-csa
authored andcommitted
Reduce codesize for door locks a bit. (project-chip#34239)
* There is no need for SupportsAliroProvisioning checks in Aliro command handlers. If we got into that code, that means that we recognized the command ID on the relevant endpoint's Door Lock cluster, and if we passed cert that means that we had the right feature map bit set too. * There is no reason to do conditional MatterReportingAttributeChangeCallback for the AliroGroupResolvingKey attribute. If we don't support the attribute, the call will just be a no-op. * There's no reason to pass attribute paths to methods that do not use them.
1 parent 9110c01 commit 2be36d7

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

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

+6-22
Original file line numberDiff line numberDiff line change
@@ -3918,14 +3918,6 @@ void DoorLockServer::setAliroReaderConfigCommandHandler(CommandHandler * command
39183918
EndpointId endpointID = commandPath.mEndpointId;
39193919
ChipLogProgress(Zcl, "[SetAliroReaderConfig] Incoming command [endpointId=%d]", endpointID);
39203920

3921-
// If Aliro Provisioning feature is not supported, return UNSUPPORTED_COMMAND.
3922-
if (!SupportsAliroProvisioning(endpointID))
3923-
{
3924-
ChipLogProgress(Zcl, "[SetAliroReaderConfig] Aliro Provisioning is not supported [endpointId=%d]", endpointID);
3925-
commandObj->AddStatus(commandPath, Status::UnsupportedCommand);
3926-
return;
3927-
}
3928-
39293921
Delegate * delegate = GetDelegate(endpointID);
39303922
if (!delegate)
39313923
{
@@ -3988,10 +3980,7 @@ void DoorLockServer::setAliroReaderConfigCommandHandler(CommandHandler * command
39883980
// Various attributes changed; mark them dirty.
39893981
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderVerificationKey::Id);
39903982
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderGroupIdentifier::Id);
3991-
if (supportsAliroBLEUWB)
3992-
{
3993-
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id);
3994-
}
3983+
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id);
39953984
}
39963985
sendClusterResponse(commandObj, commandPath, ClusterStatusCode(StatusIB(err).mStatus));
39973986
}
@@ -4038,10 +4027,7 @@ void DoorLockServer::clearAliroReaderConfigCommandHandler(CommandHandler * comma
40384027
// Various attributes changed; mark them dirty.
40394028
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderVerificationKey::Id);
40404029
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderGroupIdentifier::Id);
4041-
if (SupportsAliroBLEUWB(endpointID))
4042-
{
4043-
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id);
4044-
}
4030+
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id);
40454031
}
40464032
sendClusterResponse(commandObj, commandPath, ClusterStatusCode(StatusIB(err).mStatus));
40474033
}
@@ -4203,8 +4189,7 @@ void DoorLockServer::DoorLockOnAutoRelockCallback(System::Layer *, void * callba
42034189
}
42044190
}
42054191

4206-
CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersions(const ConcreteReadAttributePath & aPath,
4207-
AttributeValueEncoder & aEncoder,
4192+
CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersions(AttributeValueEncoder & aEncoder,
42084193
Delegate * delegate)
42094194
{
42104195
VerifyOrReturnValue(delegate != nullptr, aEncoder.EncodeEmptyList());
@@ -4225,8 +4210,7 @@ CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersion
42254210
});
42264211
}
42274212

4228-
CHIP_ERROR DoorLockServer::ReadAliroSupportedBLEUWBProtocolVersions(const ConcreteReadAttributePath & aPath,
4229-
AttributeValueEncoder & aEncoder, Delegate * delegate)
4213+
CHIP_ERROR DoorLockServer::ReadAliroSupportedBLEUWBProtocolVersions(AttributeValueEncoder & aEncoder, Delegate * delegate)
42304214
{
42314215
VerifyOrReturnValue(delegate != nullptr, aEncoder.EncodeEmptyList());
42324216

@@ -4296,7 +4280,7 @@ CHIP_ERROR DoorLockServer::Read(const ConcreteReadAttributePath & aPath, Attribu
42964280
AttributeNullabilityType::kNotNullable);
42974281
}
42984282
case AliroExpeditedTransactionSupportedProtocolVersions::Id: {
4299-
return ReadAliroExpeditedTransactionSupportedProtocolVersions(aPath, aEncoder, delegate);
4283+
return ReadAliroExpeditedTransactionSupportedProtocolVersions(aEncoder, delegate);
43004284
}
43014285
case AliroGroupResolvingKey::Id: {
43024286
uint8_t buffer[kAliroGroupResolvingKeySize];
@@ -4305,7 +4289,7 @@ CHIP_ERROR DoorLockServer::Read(const ConcreteReadAttributePath & aPath, Attribu
43054289
AttributeNullabilityType::kNullable);
43064290
}
43074291
case AliroSupportedBLEUWBProtocolVersions::Id: {
4308-
return ReadAliroSupportedBLEUWBProtocolVersions(aPath, aEncoder, delegate);
4292+
return ReadAliroSupportedBLEUWBProtocolVersions(aEncoder, delegate);
43094293
}
43104294
case AliroBLEAdvertisingVersion::Id: {
43114295
uint8_t bleAdvertisingVersion = delegate->GetAliroBLEAdvertisingVersion();

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -576,29 +576,25 @@ class DoorLockServer : public chip::app::AttributeAccessInterface
576576
/**
577577
* @brief Reads AliroExpeditedTransactionSupportedProtocolVersions attribute for door lock
578578
*
579-
* @param aPath attribute path.
580579
* @param aEncoder attribute value encoder.
581580
* @param delegate door lock cluster delegate that will provide the value
582581
*
583582
* @return CHIP_NO_ERROR on success
584583
* @return CHIP_ERROR if attribute read failed
585584
*/
586-
CHIP_ERROR ReadAliroExpeditedTransactionSupportedProtocolVersions(const chip::app::ConcreteReadAttributePath & aPath,
587-
chip::app::AttributeValueEncoder & aEncoder,
585+
CHIP_ERROR ReadAliroExpeditedTransactionSupportedProtocolVersions(chip::app::AttributeValueEncoder & aEncoder,
588586
chip::app::Clusters::DoorLock::Delegate * delegate);
589587

590588
/**
591589
* @brief Reads AliroSupportedBLEUWBProtocolVersions attribute for door lock
592590
*
593-
* @param aPath attribute path.
594591
* @param aEncoder attribute value encoder.
595592
* @param delegate door lock cluster delegate that will provide the value
596593
*
597594
* @return CHIP_NO_ERROR on success
598595
* @return CHIP_ERROR if attribute read failed
599596
*/
600-
CHIP_ERROR ReadAliroSupportedBLEUWBProtocolVersions(const chip::app::ConcreteReadAttributePath & aPath,
601-
chip::app::AttributeValueEncoder & aEncoder,
597+
CHIP_ERROR ReadAliroSupportedBLEUWBProtocolVersions(chip::app::AttributeValueEncoder & aEncoder,
602598
chip::app::Clusters::DoorLock::Delegate * delegate);
603599

604600
/**

0 commit comments

Comments
 (0)