16
16
* limitations under the License.
17
17
*/
18
18
19
+ #include " chef-lock-manager.h"
19
20
#include < iostream>
20
21
#include < lib/support/logging/CHIPLogging.h>
21
- #include " chef-lock-manager.h"
22
22
23
23
using chip::to_underlying;
24
24
@@ -115,24 +115,26 @@ bool LockManager::InitEndpoint(chip::EndpointId endpointId)
115
115
chip::FabricIndex modifier (1 );
116
116
const chip::CharSpan userName = chip::CharSpan::fromCharString (" user1" ); // default
117
117
// username
118
- uint32_t uniqueId = 0xFFFFFFFF ; // null
118
+ uint32_t uniqueId = 0xFFFFFFFF ; // null
119
119
UserStatusEnum userStatus = UserStatusEnum::kOccupiedEnabled ;
120
120
// Set to programming user instead of unrestrict user to perform
121
121
// priviledged function
122
- UserTypeEnum usertype = UserTypeEnum::kProgrammingUser ;
122
+ UserTypeEnum usertype = UserTypeEnum::kProgrammingUser ;
123
123
CredentialRuleEnum credentialRule = CredentialRuleEnum::kSingle ;
124
124
125
125
constexpr size_t totalCredentials (2 );
126
126
// According to spec (5.2.6.26.2. CredentialIndex Field), programming PIN credential should be always indexed as 0
127
127
uint16_t credentialIndex0 (0 );
128
- // 1st non ProgrammingPIN credential should be indexed as 1
128
+ // 1st non ProgrammingPIN credential should be indexed as 1
129
129
uint16_t credentialIndex1 (1 );
130
130
131
131
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
+ };
134
135
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))
136
138
{
137
139
ChipLogError (Zcl, " Unable to set the User [endpointId=%d]" , endpointId);
138
140
return false ;
@@ -141,16 +143,18 @@ bool LockManager::InitEndpoint(chip::EndpointId endpointId)
141
143
DlCredentialStatus credentialStatus = DlCredentialStatus::kOccupied ;
142
144
143
145
// 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)))
146
149
{
147
150
ChipLogError (Zcl, " Unable to set the credential - endpoint does not exist or not initialized [endpointId=%d]" , endpointId);
148
151
return false ;
149
152
}
150
153
151
154
// 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)))
154
158
{
155
159
ChipLogError (Zcl, " Unable to set the credential - endpoint does not exist or not initialized [endpointId=%d]" , endpointId);
156
160
return false ;
0 commit comments