Skip to content

Commit 84a19f3

Browse files
committed
move storage struct to EFR32DoorLock::Storage namespace
1 parent a696ae4 commit 84a19f3

File tree

2 files changed

+47
-44
lines changed

2 files changed

+47
-44
lines changed

examples/lock-app/silabs/include/LockManager.h

+46-44
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@
2929

3030
#include <lib/support/DefaultStorageKeyAllocator.h>
3131

32-
struct WeekDayScheduleInfo
33-
{
34-
DlScheduleStatus status;
35-
EmberAfPluginDoorLockWeekDaySchedule schedule;
36-
};
37-
38-
struct YearDayScheduleInfo
39-
{
40-
DlScheduleStatus status;
41-
EmberAfPluginDoorLockYearDaySchedule schedule;
42-
};
43-
44-
struct HolidayScheduleInfo
45-
{
46-
DlScheduleStatus status;
47-
EmberAfPluginDoorLockHolidaySchedule schedule;
48-
};
49-
5032
namespace EFR32DoorLock {
5133
namespace ResourceRanges {
5234
// Used to size arrays
@@ -58,8 +40,6 @@ static constexpr uint8_t kMaxHolidaySchedules = 10;
5840
static constexpr uint8_t kMaxCredentialSize = 20;
5941
static constexpr uint8_t kNumCredentialTypes = 6;
6042

61-
static constexpr uint8_t kMaxCredentials = kMaxUsers * kMaxCredentialsPerUser;
62-
6343
} // namespace ResourceRanges
6444

6545
namespace LockInitParams {
@@ -109,34 +89,56 @@ class ParamBuilder
10989
};
11090

11191
} // namespace LockInitParams
92+
namespace Storage {
93+
94+
using namespace EFR32DoorLock::ResourceRanges;
95+
struct WeekDayScheduleInfo
96+
{
97+
DlScheduleStatus status;
98+
EmberAfPluginDoorLockWeekDaySchedule schedule;
99+
};
100+
101+
struct YearDayScheduleInfo
102+
{
103+
DlScheduleStatus status;
104+
EmberAfPluginDoorLockYearDaySchedule schedule;
105+
};
106+
107+
struct HolidayScheduleInfo
108+
{
109+
DlScheduleStatus status;
110+
EmberAfPluginDoorLockHolidaySchedule schedule;
111+
};
112+
113+
struct LockUserInfo
114+
{
115+
char userName[DOOR_LOCK_MAX_USER_NAME_SIZE];
116+
size_t userNameSize;
117+
uint32_t userUniqueId;
118+
UserStatusEnum userStatus;
119+
UserTypeEnum userType;
120+
CredentialRuleEnum credentialRule;
121+
chip::EndpointId endpointId;
122+
chip::FabricIndex createdBy;
123+
chip::FabricIndex lastModifiedBy;
124+
uint16_t currentCredentialCount;
125+
};
126+
127+
struct LockCredentialInfo
128+
{
129+
DlCredentialStatus status;
130+
CredentialTypeEnum credentialType;
131+
chip::FabricIndex createdBy;
132+
chip::FabricIndex lastModifiedBy;
133+
uint8_t credentialData[kMaxCredentialSize];
134+
size_t credentialDataSize;
135+
};
136+
} // namespace Storage
112137
} // namespace EFR32DoorLock
113138

114139
using namespace ::chip;
115140
using namespace EFR32DoorLock::ResourceRanges;
116-
117-
struct LockUserInfo
118-
{
119-
char userName[DOOR_LOCK_MAX_USER_NAME_SIZE];
120-
size_t userNameSize;
121-
uint32_t userUniqueId;
122-
UserStatusEnum userStatus;
123-
UserTypeEnum userType;
124-
CredentialRuleEnum credentialRule;
125-
chip::EndpointId endpointId;
126-
chip::FabricIndex createdBy;
127-
chip::FabricIndex lastModifiedBy;
128-
uint16_t currentCredentialCount;
129-
};
130-
131-
struct LockCredentialInfo
132-
{
133-
DlCredentialStatus status;
134-
CredentialTypeEnum credentialType;
135-
chip::FabricIndex createdBy;
136-
chip::FabricIndex lastModifiedBy;
137-
uint8_t credentialData[kMaxCredentialSize];
138-
size_t credentialDataSize;
139-
};
141+
using namespace EFR32DoorLock::Storage;
140142

141143
class LockManager
142144
{

examples/lock-app/silabs/src/LockManager.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
using chip::app::DataModel::MakeNullable;
2828
using namespace ::chip::DeviceLayer::Internal;
29+
using namespace EFR32DoorLock;
2930
using namespace EFR32DoorLock::LockInitParams;
3031

3132
namespace {

0 commit comments

Comments
 (0)