diff --git a/examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp b/examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp index 22d5c9920da2d6..fd40f744457b98 100644 --- a/examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp +++ b/examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp @@ -15,11 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "chef-lock-endpoint.h" #include #include #include #include -#include "chef-lock-endpoint.h" using chip::to_underlying; using chip::app::DataModel::MakeNullable; @@ -605,8 +605,9 @@ bool LockEndpoint::weekDayScheduleForbidsAccess(uint16_t userIndex, bool * haveS [currentTime, calendarTime](const WeekDaysScheduleInfo & s) { auto startTime = s.schedule.startHour * chip::kSecondsPerHour + s.schedule.startMinute * chip::kSecondsPerMinute; auto endTime = s.schedule.endHour * chip::kSecondsPerHour + s.schedule.endMinute * chip::kSecondsPerMinute; - bool ret = (s.status == DlScheduleStatus::kOccupied && (to_underlying(s.schedule.daysMask) & (1 << calendarTime.tm_wday)) && - startTime <= currentTime && currentTime <= endTime); + bool ret = + (s.status == DlScheduleStatus::kOccupied && (to_underlying(s.schedule.daysMask) & (1 << calendarTime.tm_wday)) && + startTime <= currentTime && currentTime <= endTime); return s.status == DlScheduleStatus::kOccupied && (to_underlying(s.schedule.daysMask) & (1 << calendarTime.tm_wday)) && startTime <= currentTime && currentTime <= endTime; }); diff --git a/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp b/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp index fa974e394788c8..3b74c106bf66c6 100644 --- a/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp +++ b/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp @@ -16,9 +16,9 @@ * limitations under the License. */ +#include "chef-lock-manager.h" #include #include -#include "chef-lock-manager.h" using chip::to_underlying; @@ -115,24 +115,26 @@ bool LockManager::InitEndpoint(chip::EndpointId endpointId) chip::FabricIndex modifier(1); const chip::CharSpan userName = chip::CharSpan::fromCharString("user1"); // default // username - uint32_t uniqueId = 0xFFFFFFFF; // null + uint32_t uniqueId = 0xFFFFFFFF; // null UserStatusEnum userStatus = UserStatusEnum::kOccupiedEnabled; // Set to programming user instead of unrestrict user to perform // priviledged function - UserTypeEnum usertype = UserTypeEnum::kProgrammingUser; + UserTypeEnum usertype = UserTypeEnum::kProgrammingUser; CredentialRuleEnum credentialRule = CredentialRuleEnum::kSingle; constexpr size_t totalCredentials(2); // According to spec (5.2.6.26.2. CredentialIndex Field), programming PIN credential should be always indexed as 0 uint16_t credentialIndex0(0); - // 1st non ProgrammingPIN credential should be indexed as 1 + // 1st non ProgrammingPIN credential should be indexed as 1 uint16_t credentialIndex1(1); const CredentialStruct credentials[totalCredentials] = { - {credentialType: CredentialTypeEnum::kProgrammingPIN, credentialIndex: credentialIndex0}, - {credentialType: CredentialTypeEnum::kPin, credentialIndex: credentialIndex1}}; + { credentialType : CredentialTypeEnum::kProgrammingPIN, credentialIndex : credentialIndex0 }, + { credentialType : CredentialTypeEnum::kPin, credentialIndex : credentialIndex1 } + }; - if (!SetUser(endpointId, userIndex, creator, modifier, userName, uniqueId, userStatus, usertype, credentialRule, &credentials[0], totalCredentials)) + if (!SetUser(endpointId, userIndex, creator, modifier, userName, uniqueId, userStatus, usertype, credentialRule, + &credentials[0], totalCredentials)) { ChipLogError(Zcl, "Unable to set the User [endpointId=%d]", endpointId); return false; @@ -141,16 +143,18 @@ bool LockManager::InitEndpoint(chip::EndpointId endpointId) DlCredentialStatus credentialStatus = DlCredentialStatus::kOccupied; // Set the default user's ProgrammingPIN credential - uint8_t defaultProgrammingPIN[6] = { 0x39, 0x39, 0x39, 0x39, 0x39, 0x39 }; // 000000 - if (!SetCredential(endpointId, credentialIndex0, creator, modifier, credentialStatus, CredentialTypeEnum::kProgrammingPIN, chip::ByteSpan(defaultProgrammingPIN))) + uint8_t defaultProgrammingPIN[6] = { 0x39, 0x39, 0x39, 0x39, 0x39, 0x39 }; // 000000 + if (!SetCredential(endpointId, credentialIndex0, creator, modifier, credentialStatus, CredentialTypeEnum::kProgrammingPIN, + chip::ByteSpan(defaultProgrammingPIN))) { ChipLogError(Zcl, "Unable to set the credential - endpoint does not exist or not initialized [endpointId=%d]", endpointId); return false; } // Set the default user's non ProgrammingPIN credential - uint8_t defaultPin[6] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 }; // 123456 - if (!SetCredential(endpointId, credentialIndex1, creator, modifier, credentialStatus, CredentialTypeEnum::kPin, chip::ByteSpan(defaultPin))) + uint8_t defaultPin[6] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 }; // 123456 + if (!SetCredential(endpointId, credentialIndex1, creator, modifier, credentialStatus, CredentialTypeEnum::kPin, + chip::ByteSpan(defaultPin))) { ChipLogError(Zcl, "Unable to set the credential - endpoint does not exist or not initialized [endpointId=%d]", endpointId); return false; diff --git a/examples/chef/common/clusters/door-lock/chef-lock-manager.h b/examples/chef/common/clusters/door-lock/chef-lock-manager.h index 1fdb50be96b068..57530c84f9114a 100644 --- a/examples/chef/common/clusters/door-lock/chef-lock-manager.h +++ b/examples/chef/common/clusters/door-lock/chef-lock-manager.h @@ -18,9 +18,9 @@ #pragma once +#include "chef-lock-endpoint.h" #include #include -#include "chef-lock-endpoint.h" #include