Skip to content

Commit eb4bd7c

Browse files
restyled-commitserwinpan1
authored andcommitted
Restyled by clang-format
1 parent a093820 commit eb4bd7c

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

examples/chef/common/clusters/door-lock/chef-lock-endpoint.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18+
#include "chef-lock-endpoint.h"
1819
#include <app-common/zap-generated/attributes/Accessors.h>
1920
#include <cstring>
2021
#include <platform/CHIPDeviceLayer.h>
2122
#include <platform/internal/CHIPDeviceLayerInternal.h>
22-
#include "chef-lock-endpoint.h"
2323

2424
using chip::to_underlying;
2525
using chip::app::DataModel::MakeNullable;
@@ -605,8 +605,9 @@ bool LockEndpoint::weekDayScheduleForbidsAccess(uint16_t userIndex, bool * haveS
605605
[currentTime, calendarTime](const WeekDaysScheduleInfo & s) {
606606
auto startTime = s.schedule.startHour * chip::kSecondsPerHour + s.schedule.startMinute * chip::kSecondsPerMinute;
607607
auto endTime = s.schedule.endHour * chip::kSecondsPerHour + s.schedule.endMinute * chip::kSecondsPerMinute;
608-
bool ret = (s.status == DlScheduleStatus::kOccupied && (to_underlying(s.schedule.daysMask) & (1 << calendarTime.tm_wday)) &&
609-
startTime <= currentTime && currentTime <= endTime);
608+
bool ret =
609+
(s.status == DlScheduleStatus::kOccupied && (to_underlying(s.schedule.daysMask) & (1 << calendarTime.tm_wday)) &&
610+
startTime <= currentTime && currentTime <= endTime);
610611
return s.status == DlScheduleStatus::kOccupied && (to_underlying(s.schedule.daysMask) & (1 << calendarTime.tm_wday)) &&
611612
startTime <= currentTime && currentTime <= endTime;
612613
});

examples/chef/common/clusters/door-lock/chef-lock-manager.cpp

+15-11
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
* limitations under the License.
1717
*/
1818

19+
#include "chef-lock-manager.h"
1920
#include <iostream>
2021
#include <lib/support/logging/CHIPLogging.h>
21-
#include "chef-lock-manager.h"
2222

2323
using chip::to_underlying;
2424

@@ -115,24 +115,26 @@ bool LockManager::InitEndpoint(chip::EndpointId endpointId)
115115
chip::FabricIndex modifier(1);
116116
const chip::CharSpan userName = chip::CharSpan::fromCharString("user1"); // default
117117
// username
118-
uint32_t uniqueId = 0xFFFFFFFF; // null
118+
uint32_t uniqueId = 0xFFFFFFFF; // null
119119
UserStatusEnum userStatus = UserStatusEnum::kOccupiedEnabled;
120120
// Set to programming user instead of unrestrict user to perform
121121
// priviledged function
122-
UserTypeEnum usertype = UserTypeEnum::kProgrammingUser;
122+
UserTypeEnum usertype = UserTypeEnum::kProgrammingUser;
123123
CredentialRuleEnum credentialRule = CredentialRuleEnum::kSingle;
124124

125125
constexpr size_t totalCredentials(2);
126126
// According to spec (5.2.6.26.2. CredentialIndex Field), programming PIN credential should be always indexed as 0
127127
uint16_t credentialIndex0(0);
128-
// 1st non ProgrammingPIN credential should be indexed as 1
128+
// 1st non ProgrammingPIN credential should be indexed as 1
129129
uint16_t credentialIndex1(1);
130130

131131
const CredentialStruct credentials[totalCredentials] = {
132-
{credentialType: CredentialTypeEnum::kProgrammingPIN, credentialIndex: credentialIndex0},
133-
{credentialType: CredentialTypeEnum::kPin, credentialIndex: credentialIndex1}};
132+
{ credentialType : CredentialTypeEnum::kProgrammingPIN, credentialIndex : credentialIndex0 },
133+
{ credentialType : CredentialTypeEnum::kPin, credentialIndex : credentialIndex1 }
134+
};
134135

135-
if (!SetUser(endpointId, userIndex, creator, modifier, userName, uniqueId, userStatus, usertype, credentialRule, &credentials[0], totalCredentials))
136+
if (!SetUser(endpointId, userIndex, creator, modifier, userName, uniqueId, userStatus, usertype, credentialRule,
137+
&credentials[0], totalCredentials))
136138
{
137139
ChipLogError(Zcl, "Unable to set the User [endpointId=%d]", endpointId);
138140
return false;
@@ -141,16 +143,18 @@ bool LockManager::InitEndpoint(chip::EndpointId endpointId)
141143
DlCredentialStatus credentialStatus = DlCredentialStatus::kOccupied;
142144

143145
// Set the default user's ProgrammingPIN credential
144-
uint8_t defaultProgrammingPIN[6] = { 0x39, 0x39, 0x39, 0x39, 0x39, 0x39 }; // 000000
145-
if (!SetCredential(endpointId, credentialIndex0, creator, modifier, credentialStatus, CredentialTypeEnum::kProgrammingPIN, chip::ByteSpan(defaultProgrammingPIN)))
146+
uint8_t defaultProgrammingPIN[6] = { 0x39, 0x39, 0x39, 0x39, 0x39, 0x39 }; // 000000
147+
if (!SetCredential(endpointId, credentialIndex0, creator, modifier, credentialStatus, CredentialTypeEnum::kProgrammingPIN,
148+
chip::ByteSpan(defaultProgrammingPIN)))
146149
{
147150
ChipLogError(Zcl, "Unable to set the credential - endpoint does not exist or not initialized [endpointId=%d]", endpointId);
148151
return false;
149152
}
150153

151154
// Set the default user's non ProgrammingPIN credential
152-
uint8_t defaultPin[6] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 }; // 123456
153-
if (!SetCredential(endpointId, credentialIndex1, creator, modifier, credentialStatus, CredentialTypeEnum::kPin, chip::ByteSpan(defaultPin)))
155+
uint8_t defaultPin[6] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 }; // 123456
156+
if (!SetCredential(endpointId, credentialIndex1, creator, modifier, credentialStatus, CredentialTypeEnum::kPin,
157+
chip::ByteSpan(defaultPin)))
154158
{
155159
ChipLogError(Zcl, "Unable to set the credential - endpoint does not exist or not initialized [endpointId=%d]", endpointId);
156160
return false;

examples/chef/common/clusters/door-lock/chef-lock-manager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
#pragma once
2020

21+
#include "chef-lock-endpoint.h"
2122
#include <app/clusters/door-lock-server/door-lock-server.h>
2223
#include <cstdint>
23-
#include "chef-lock-endpoint.h"
2424

2525
#include <app/util/af.h>
2626

0 commit comments

Comments
 (0)