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

Fix missing cases in some door lock switch statements. #24797

Merged
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
36 changes: 36 additions & 0 deletions src/app/clusters/door-lock-server/door-lock-server-callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,39 @@ emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t holidayInd
void __attribute__((weak))
emberAfPluginDoorLockLockoutStarted(chip::EndpointId endpointId, chip::System::Clock::Timestamp lockoutEndTime)
{}

bool __attribute__((weak))
emberAfPluginDoorLockGetNumberOfFingerprintCredentialsSupported(chip::EndpointId endpointId, uint16_t & maxNumberOfCredentials)
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockGetNumberOfFingerVeinCredentialsSupported(chip::EndpointId endpointId, uint16_t & maxNumberOfCredentials)
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockGetNumberOfFaceCredentialsSupported(chip::EndpointId endpointId, uint16_t & maxNumberOfCredentials)
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockGetFingerprintCredentialLengthConstraints(chip::EndpointId endpointId, uint8_t & minLen, uint8_t & maxLen)
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockGetFingerVeinCredentialLengthConstraints(chip::EndpointId endpointId, uint8_t & minLen, uint8_t & maxLen)
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockGetFaceCredentialLengthConstraints(chip::EndpointId endpointId, uint8_t & minLen, uint8_t & maxLen)
{
return false;
}
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 @@ -1457,6 +1457,15 @@ DlStatus DoorLockServer::credentialLengthWithinRange(chip::EndpointId endpointId
statusMin = GetAttribute(endpointId, Attributes::MinRFIDCodeLength::Id, Attributes::MinRFIDCodeLength::Get, minLen);
statusMax = GetAttribute(endpointId, Attributes::MaxRFIDCodeLength::Id, Attributes::MaxRFIDCodeLength::Get, maxLen);
break;
case CredentialTypeEnum::kFingerprint:
statusMin = statusMax = emberAfPluginDoorLockGetFingerprintCredentialLengthConstraints(endpointId, minLen, maxLen);
break;
case CredentialTypeEnum::kFingerVein:
statusMin = statusMax = emberAfPluginDoorLockGetFingerVeinCredentialLengthConstraints(endpointId, minLen, maxLen);
break;
case CredentialTypeEnum::kFace:
statusMin = statusMax = emberAfPluginDoorLockGetFaceCredentialLengthConstraints(endpointId, minLen, maxLen);
break;
default:
return DlStatus::kFailure;
}
Expand Down Expand Up @@ -1496,6 +1505,15 @@ bool DoorLockServer::getMaxNumberOfCredentials(chip::EndpointId endpointId, Cred
case CredentialTypeEnum::kRfid:
status = GetNumberOfRFIDCredentialsSupported(endpointId, maxNumberOfCredentials);
break;
case CredentialTypeEnum::kFingerprint:
status = emberAfPluginDoorLockGetNumberOfFingerprintCredentialsSupported(endpointId, maxNumberOfCredentials);
break;
case CredentialTypeEnum::kFingerVein:
status = emberAfPluginDoorLockGetNumberOfFingerVeinCredentialsSupported(endpointId, maxNumberOfCredentials);
break;
case CredentialTypeEnum::kFace:
status = emberAfPluginDoorLockGetNumberOfFaceCredentialsSupported(endpointId, maxNumberOfCredentials);
break;
default:
return false;
}
Expand Down Expand Up @@ -2391,6 +2409,11 @@ bool DoorLockServer::credentialTypeSupported(chip::EndpointId endpointId, Creden
return SupportsPIN(endpointId);
case CredentialTypeEnum::kRfid:
return SupportsRFID(endpointId);
case CredentialTypeEnum::kFingerprint:
case CredentialTypeEnum::kFingerVein:
return SupportsFingers(endpointId);
case CredentialTypeEnum::kFace:
return SupportsFace(endpointId);
default:
return false;
}
Expand Down
80 changes: 80 additions & 0 deletions src/app/clusters/door-lock-server/door-lock-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -992,3 +992,83 @@ bool emberAfPluginDoorLockSetCredential(chip::EndpointId endpointId, uint16_t cr
* @param lockoutEndTime Monotonic time of when lockout ends.
*/
void emberAfPluginDoorLockLockoutStarted(chip::EndpointId endpointId, chip::System::Clock::Timestamp lockoutEndTime);

/**
* @brief This callback is called when the Door Lock server needs to find out
* the number of Fingerprint credentials supported, since there is no attribute
* that represents that value.
*
* @param[in] endpointId ID of the endpoint that contains the door lock.
* @param[out] maxNumberOfCredentials the number of Fingerprint credentials supported by the lock.
*
* @return false on failure, true on success. On failure, the cluster
* implementation will assume that 0 Fingerprint credentials are supported.
*/
bool emberAfPluginDoorLockGetNumberOfFingerprintCredentialsSupported(chip::EndpointId endpointId,
uint16_t & maxNumberOfCredentials);

/**
* @brief This callback is called when the Door Lock server needs to find out
* the number of FingerVein credentials supported, since there is no attribute
* that represents that value.
*
* @param[in] endpointId ID of the endpoint that contains the door lock.
* @param[out] maxNumberOfCredentials the number of FingerVein credentials supported by the lock.
*
* @return false on failure, true on success. On failure, the cluster
* implementation will assume that 0 FingerVein credentials are supported.
*/
bool emberAfPluginDoorLockGetNumberOfFingerVeinCredentialsSupported(chip::EndpointId endpointId, uint16_t & maxNumberOfCredentials);

/**
* @brief This callback is called when the Door Lock server needs to find out
* the number of Face credentials supported, since there is no attribute
* that represents that value.
*
* @param[in] endpointId ID of the endpoint that contains the door lock.
* @param[out] maxNumberOfCredentials the number of Face credentials supported by the lock.
*
* @return false on failure, true on success. On failure, the cluster
* implementation will assume that 0 Face credentials are supported.
*/
bool emberAfPluginDoorLockGetNumberOfFaceCredentialsSupported(chip::EndpointId endpointId, uint16_t & maxNumberOfCredentials);

/**
* @brief This callback is called when the Door Lock server needs to find out
* the min and max lengths of Fingerprint credentials supported, since there are no
* attributes that represents those values.
*
* @param[in] endpointId ID of the endpoint that contains the door lock.
* @param[out] minLen the minimal length, in bytes, of a Fingerprint credential supported by the lock.
* @param[out] maxLen the minimal length, in bytes, of a Fingerprint credential supported by the lock.
*
* @return false on failure, true on success.
*/
bool emberAfPluginDoorLockGetFingerprintCredentialLengthConstraints(chip::EndpointId endpointId, uint8_t & minLen,
uint8_t & maxLen);

/**
* @brief This callback is called when the Door Lock server needs to find out
* the min and max lengths of FingerVein credentials supported, since there are no
* attributes that represents those values.
*
* @param[in] endpointId ID of the endpoint that contains the door lock.
* @param[out] minLen the minimal length, in bytes, of a FingerVein credential supported by the lock.
* @param[out] maxLen the minimal length, in bytes, of a FingerVein credential supported by the lock.
*
* @return false on failure, true on success.
*/
bool emberAfPluginDoorLockGetFingerVeinCredentialLengthConstraints(chip::EndpointId endpointId, uint8_t & minLen, uint8_t & maxLen);

/**
* @brief This callback is called when the Door Lock server needs to find out
* the min and max lengths of Face credentials supported, since there are no
* attributes that represents those values.
*
* @param[in] endpointId ID of the endpoint that contains the door lock.
* @param[out] minLen the minimal length, in bytes, of a Face credential supported by the lock.
* @param[out] maxLen the minimal length, in bytes, of a Face credential supported by the lock.
*
* @return false on failure, true on success.
*/
bool emberAfPluginDoorLockGetFaceCredentialLengthConstraints(chip::EndpointId endpointId, uint8_t & minLen, uint8_t & maxLen);