Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce codesize for door locks a bit. #34239

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 6 additions & 22 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3918,14 +3918,6 @@ void DoorLockServer::setAliroReaderConfigCommandHandler(CommandHandler * command
EndpointId endpointID = commandPath.mEndpointId;
ChipLogProgress(Zcl, "[SetAliroReaderConfig] Incoming command [endpointId=%d]", endpointID);

// If Aliro Provisioning feature is not supported, return UNSUPPORTED_COMMAND.
if (!SupportsAliroProvisioning(endpointID))
{
ChipLogProgress(Zcl, "[SetAliroReaderConfig] Aliro Provisioning is not supported [endpointId=%d]", endpointID);
commandObj->AddStatus(commandPath, Status::UnsupportedCommand);
return;
}

Delegate * delegate = GetDelegate(endpointID);
if (!delegate)
{
Expand Down Expand Up @@ -3988,10 +3980,7 @@ void DoorLockServer::setAliroReaderConfigCommandHandler(CommandHandler * command
// Various attributes changed; mark them dirty.
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderVerificationKey::Id);
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderGroupIdentifier::Id);
if (supportsAliroBLEUWB)
{
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id);
}
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id);
}
sendClusterResponse(commandObj, commandPath, ClusterStatusCode(StatusIB(err).mStatus));
}
Expand Down Expand Up @@ -4038,10 +4027,7 @@ void DoorLockServer::clearAliroReaderConfigCommandHandler(CommandHandler * comma
// Various attributes changed; mark them dirty.
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderVerificationKey::Id);
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderGroupIdentifier::Id);
if (SupportsAliroBLEUWB(endpointID))
{
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id);
}
MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id);
}
sendClusterResponse(commandObj, commandPath, ClusterStatusCode(StatusIB(err).mStatus));
}
Expand Down Expand Up @@ -4203,8 +4189,7 @@ void DoorLockServer::DoorLockOnAutoRelockCallback(System::Layer *, void * callba
}
}

CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersions(const ConcreteReadAttributePath & aPath,
AttributeValueEncoder & aEncoder,
CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersions(AttributeValueEncoder & aEncoder,
Delegate * delegate)
{
VerifyOrReturnValue(delegate != nullptr, aEncoder.EncodeEmptyList());
Expand All @@ -4225,8 +4210,7 @@ CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersion
});
}

CHIP_ERROR DoorLockServer::ReadAliroSupportedBLEUWBProtocolVersions(const ConcreteReadAttributePath & aPath,
AttributeValueEncoder & aEncoder, Delegate * delegate)
CHIP_ERROR DoorLockServer::ReadAliroSupportedBLEUWBProtocolVersions(AttributeValueEncoder & aEncoder, Delegate * delegate)
{
VerifyOrReturnValue(delegate != nullptr, aEncoder.EncodeEmptyList());

Expand Down Expand Up @@ -4296,7 +4280,7 @@ CHIP_ERROR DoorLockServer::Read(const ConcreteReadAttributePath & aPath, Attribu
AttributeNullabilityType::kNotNullable);
}
case AliroExpeditedTransactionSupportedProtocolVersions::Id: {
return ReadAliroExpeditedTransactionSupportedProtocolVersions(aPath, aEncoder, delegate);
return ReadAliroExpeditedTransactionSupportedProtocolVersions(aEncoder, delegate);
}
case AliroGroupResolvingKey::Id: {
uint8_t buffer[kAliroGroupResolvingKeySize];
Expand All @@ -4305,7 +4289,7 @@ CHIP_ERROR DoorLockServer::Read(const ConcreteReadAttributePath & aPath, Attribu
AttributeNullabilityType::kNullable);
}
case AliroSupportedBLEUWBProtocolVersions::Id: {
return ReadAliroSupportedBLEUWBProtocolVersions(aPath, aEncoder, delegate);
return ReadAliroSupportedBLEUWBProtocolVersions(aEncoder, delegate);
}
case AliroBLEAdvertisingVersion::Id: {
uint8_t bleAdvertisingVersion = delegate->GetAliroBLEAdvertisingVersion();
Expand Down
8 changes: 2 additions & 6 deletions src/app/clusters/door-lock-server/door-lock-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,29 +576,25 @@ class DoorLockServer : public chip::app::AttributeAccessInterface
/**
* @brief Reads AliroExpeditedTransactionSupportedProtocolVersions attribute for door lock
*
* @param aPath attribute path.
* @param aEncoder attribute value encoder.
* @param delegate door lock cluster delegate that will provide the value
*
* @return CHIP_NO_ERROR on success
* @return CHIP_ERROR if attribute read failed
*/
CHIP_ERROR ReadAliroExpeditedTransactionSupportedProtocolVersions(const chip::app::ConcreteReadAttributePath & aPath,
chip::app::AttributeValueEncoder & aEncoder,
CHIP_ERROR ReadAliroExpeditedTransactionSupportedProtocolVersions(chip::app::AttributeValueEncoder & aEncoder,
chip::app::Clusters::DoorLock::Delegate * delegate);

/**
* @brief Reads AliroSupportedBLEUWBProtocolVersions attribute for door lock
*
* @param aPath attribute path.
* @param aEncoder attribute value encoder.
* @param delegate door lock cluster delegate that will provide the value
*
* @return CHIP_NO_ERROR on success
* @return CHIP_ERROR if attribute read failed
*/
CHIP_ERROR ReadAliroSupportedBLEUWBProtocolVersions(const chip::app::ConcreteReadAttributePath & aPath,
chip::app::AttributeValueEncoder & aEncoder,
CHIP_ERROR ReadAliroSupportedBLEUWBProtocolVersions(chip::app::AttributeValueEncoder & aEncoder,
chip::app::Clusters::DoorLock::Delegate * delegate);

/**
Expand Down
Loading