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

Door lock cluster relocking support #14881

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
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ server cluster DoorLock = 257 {
attribute boolean enablePrivacyModeButton = 43;
attribute int8u wrongCodeEntryLimit = 48;
attribute int8u userCodeTemporaryDisableTime = 49;
attribute boolean requirePINforRemoteOperation = 51;
readonly global attribute bitmap32 featureMap = 65532;
readonly global attribute int16u clusterRevision = 65533;

Expand Down
4 changes: 2 additions & 2 deletions examples/door-lock-app/door-lock-common/door-lock-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -6868,12 +6868,12 @@
"code": 51,
"mfgCode": null,
"side": "server",
"included": 0,
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 0,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
Expand Down
294 changes: 135 additions & 159 deletions src/app/clusters/door-lock-server/door-lock-server.cpp

Large diffs are not rendered by default.

43 changes: 43 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 @@ -86,6 +86,7 @@ class DoorLockServer
bool SetOneTouchLocking(chip::EndpointId endpointId, bool isEnabled);
bool SetPrivacyModeButton(chip::EndpointId endpointId, bool isEnabled);

bool GetAutoRelockTime(chip::EndpointId endpointId, uint32_t & autoRelockTime);
bool GetNumberOfUserSupported(chip::EndpointId endpointId, uint16_t & numberOfUsersSupported);
bool GetNumberOfPINCredentialsSupported(chip::EndpointId endpointId, uint16_t & numberOfPINCredentials);
bool GetNumberOfRFIDCredentialsSupported(chip::EndpointId endpointId, uint16_t & numberOfRFIDCredentials);
Expand Down Expand Up @@ -293,6 +294,14 @@ class DoorLockServer
Nullable<chip::NodeId> nodeId, LockOpCredentials * credList, size_t credListSize,
bool opSuccess = true);

/**
* @brief Schedule auto relocking with a given timeout
*
* @param endpointId endpoint where DoorLockServer is running
* @param timeoutSec timeout in seconds
*/
void ScheduleAutoRelock(chip::EndpointId endpointId, uint32_t timeoutSec);

/**
* @brief Send generic event
*
Expand All @@ -303,6 +312,36 @@ class DoorLockServer
template <typename T>
void SendEvent(chip::EndpointId endpointId, T & event);

/**
* @brief Get generic attribute value
*
* @tparam T attribute value type
* @param endpointId endpoint where DoorLockServer is running
* @param attributeId attribute Id (used for logging only)
* @param getFn attribute getter function as defined in <Accessors.h>
* @param value actual attribute value on success
* @return true on success (value is set to the actual attribute value)
* @return false if attribute reading failed (value is kept unchanged)
*/
template <typename T>
bool GetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId,
EmberAfStatus (*getFn)(chip::EndpointId endpointId, T * value), T & value);

/**
* @brief Set generic attribute value
*
* @tparam T attribute value type
* @param endpointId endpoint where DoorLockServer is running
* @param attributeId attribute Id (used for logging only)
* @param setFn attribute setter function as defined in <Accessors.h>
* @param value new attribute value
* @return true on success
* @return false if attribute writing failed
*/
template <typename T>
bool SetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId,
EmberAfStatus (*setFn)(chip::EndpointId endpointId, T value), T value);

friend bool
emberAfDoorLockClusterLockDoorCallback(chip::app::CommandHandler * commandObj,
const chip::app::ConcreteCommandPath & commandPath,
Expand All @@ -316,6 +355,10 @@ class DoorLockServer
chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
const chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::DecodableType & commandData);

friend void emberAfPluginDoorLockOnAutoRelock(chip::EndpointId endpointId);

EmberEventControl AutolockEvent; /**< for automatic relock scheduling */

static DoorLockServer instance;
};

Expand Down
4 changes: 0 additions & 4 deletions zzz_generated/all-clusters-app/zap-generated/af-gen-event.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions zzz_generated/door-lock-app/zap-generated/endpoint_config.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions zzz_generated/thermostat/zap-generated/af-gen-event.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions zzz_generated/tv-casting-app/zap-generated/af-gen-event.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.