@@ -95,34 +95,48 @@ struct AttributeEntry
95
95
AttributeId attributeId;
96
96
97
97
// Constructor
98
- constexpr AttributeEntry () : attributeId(0 ), mask{ 0 , kNoPrivilege , kNoPrivilege } {}
98
+ constexpr AttributeEntry (AttributeId id = 0 ,
99
+ std::underlying_type_t <AttributeQualityFlags> attrQualityFlags = 0 ,
100
+ std::underlying_type_t <Access::Privilege> readPriv = kNoPrivilege ,
101
+ std::underlying_type_t <Access::Privilege> writePriv = kNoPrivilege
102
+ ) : attributeId(id), mask{ attrQualityFlags, readPriv, writePriv } {}
99
103
100
-
101
- void SetReadPrivilege (Access::Privilege r)
104
+
105
+
106
+ // Overload assignment operator for mask.readPrivilege
107
+ AttributeEntry& operator =(Access::Privilege value)
102
108
{
103
109
// Static ASSERT to check size of readPrivilege type vs entry parameter.
104
110
static_assert (sizeof (std::underlying_type_t <Access::Privilege>) >=
105
- sizeof (chip::to_underlying (r )),
106
- " Size of readPrivilege is not able to accomodate parameter (r )." );
111
+ sizeof (chip::to_underlying (value )),
112
+ " Size of readPrivilege is not able to accomodate parameter (value )." );
107
113
108
- mask.readPrivilege = chip::to_underlying (r);
114
+ this ->mask .readPrivilege = chip::to_underlying (value);
115
+ return *this ;
109
116
}
110
117
111
- Access::Privilege GetReadPrivilege () const
112
- {
113
- return static_cast < Access::Privilege >(mask.readPrivilege );
114
- }
115
118
116
- void SetWritePrivilege (Access::Privilege w)
119
+ // Overload assignment operator for mask.writePrivilege
120
+ AttributeEntry& operator =(std::underlying_type_t <Access::Privilege> value)
117
121
{
118
122
// Static ASSERT to check size of writePrivilege type vs entry parameter.
119
123
static_assert (sizeof (std::underlying_type_t <Access::Privilege>) >=
120
- sizeof (chip::to_underlying (w) ),
121
- " Size of writePrivilege is not able to accomodate parameter (w )." );
124
+ sizeof (value ),
125
+ " Size of writePrivilege is not able to accomodate parameter (value )." );
122
126
123
- mask.writePrivilege = chip::to_underlying (w);
127
+ this ->mask .writePrivilege = value;
128
+ return *this ;
124
129
}
125
130
131
+
132
+ // Getter for mask.readPrivilege
133
+ Access::Privilege GetReadPrivilege () const
134
+ {
135
+ return static_cast < Access::Privilege >(mask.readPrivilege );
136
+ }
137
+
138
+
139
+ // Getter for mask.writePrivilege
126
140
Access::Privilege GetWritePrivilege () const
127
141
{
128
142
return static_cast < Access::Privilege >(mask.writePrivilege );
@@ -186,25 +200,31 @@ enum class CommandQualityFlags : uint32_t
186
200
187
201
struct AcceptedCommandEntry
188
202
{
189
- CommandId commandId;
190
203
204
+ CommandId commandId;
191
205
192
206
// Constructor
193
- constexpr AcceptedCommandEntry () : commandId(0 ),
194
- mask{ 0 , chip::to_underlying (Access::Privilege::kOperate ) } {}
207
+ constexpr AcceptedCommandEntry (CommandId id = 0 ,
208
+ std::underlying_type_t <CommandQualityFlags> cmdQualityFlags = 0 ,
209
+ std::underlying_type_t <Access::Privilege> invokePriv = kNoPrivilege
210
+ ) : commandId(id), mask{ cmdQualityFlags, invokePriv } {}
195
211
196
212
197
- void SetInvokePrivilege (Access::Privilege i)
213
+
214
+ // Overload assignment operator for mask.invokePrivilege
215
+ AcceptedCommandEntry& operator =(Access::Privilege value)
198
216
{
199
217
// Static ASSERT to check size of invokePrivilege type vs entry parameter.
200
218
static_assert (sizeof (std::underlying_type_t <Access::Privilege>) >=
201
- sizeof (chip::to_underlying (i )),
202
- " Size of invokePrivilege is not able to accomodate parameter (i )." );
219
+ sizeof (chip::to_underlying (value )),
220
+ " Size of invokePrivilege is not able to accomodate parameter (value )." );
203
221
204
- mask.invokePrivilege = chip::to_underlying (i);
222
+ this ->mask .invokePrivilege = chip::to_underlying (value);
223
+ return *this ;
205
224
}
206
-
225
+
207
226
227
+ // Getter for mask.invokePrivilege
208
228
Access::Privilege GetInvokePrivilege () const
209
229
{
210
230
return static_cast < Access::Privilege >(mask.invokePrivilege );
0 commit comments