Coverage Report

Created: 2026-04-09 06:56

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/connectedhomeip/zzz_generated/app-common/clusters/AccessControl/Structs.ipp
Line
Count
Source
1
/*
2
 *
3
 *    Copyright (c) 2022 Project CHIP Authors
4
 *
5
 *    Licensed under the Apache License, Version 2.0 (the "License");
6
 *    you may not use this file except in compliance with the License.
7
 *    You may obtain a copy of the License at
8
 *
9
 *        http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 *    Unless required by applicable law or agreed to in writing, software
12
 *    distributed under the License is distributed on an "AS IS" BASIS,
13
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 *    See the License for the specific language governing permissions and
15
 *    limitations under the License.
16
 */
17
18
// THIS FILE IS GENERATED BY ZAP
19
// This file is generated from clusters-Structs.ipp.zapt
20
21
#include <clusters/AccessControl/Structs.h>
22
23
#include <app/data-model/StructDecodeIterator.h>
24
#include <app/data-model/WrappedStructEncoder.h>
25
26
namespace chip {
27
namespace app {
28
namespace Clusters {
29
namespace AccessControl {
30
namespace Structs {
31
32
namespace AccessRestrictionStruct {
33
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
34
0
{
35
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
36
0
    encoder.Encode(to_underlying(Fields::kType), type);
37
0
    encoder.Encode(to_underlying(Fields::kId), id);
38
0
    return encoder.Finalize();
39
0
}
40
41
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
42
0
{
43
0
    detail::StructDecodeIterator __iterator(reader);
44
0
    while (true)
45
0
    {
46
0
        uint8_t __context_tag = 0;
47
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
48
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
49
0
        ReturnErrorOnFailure(err);
50
51
0
        if (__context_tag == to_underlying(Fields::kType))
52
0
        {
53
0
            err = DataModel::Decode(reader, type);
54
0
        }
55
0
        else if (__context_tag == to_underlying(Fields::kId))
56
0
        {
57
0
            err = DataModel::Decode(reader, id);
58
0
        }
59
60
0
        ReturnErrorOnFailure(err);
61
0
    }
62
0
}
63
64
} // namespace AccessRestrictionStruct
65
66
namespace CommissioningAccessRestrictionEntryStruct {
67
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
68
0
{
69
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
70
0
    encoder.Encode(to_underlying(Fields::kEndpoint), endpoint);
71
0
    encoder.Encode(to_underlying(Fields::kCluster), cluster);
72
0
    encoder.Encode(to_underlying(Fields::kRestrictions), restrictions);
73
0
    return encoder.Finalize();
74
0
}
75
76
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
77
0
{
78
0
    detail::StructDecodeIterator __iterator(reader);
79
0
    while (true)
80
0
    {
81
0
        uint8_t __context_tag = 0;
82
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
83
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
84
0
        ReturnErrorOnFailure(err);
85
86
0
        if (__context_tag == to_underlying(Fields::kEndpoint))
87
0
        {
88
0
            err = DataModel::Decode(reader, endpoint);
89
0
        }
90
0
        else if (__context_tag == to_underlying(Fields::kCluster))
91
0
        {
92
0
            err = DataModel::Decode(reader, cluster);
93
0
        }
94
0
        else if (__context_tag == to_underlying(Fields::kRestrictions))
95
0
        {
96
0
            err = DataModel::Decode(reader, restrictions);
97
0
        }
98
99
0
        ReturnErrorOnFailure(err);
100
0
    }
101
0
}
102
103
} // namespace CommissioningAccessRestrictionEntryStruct
104
105
namespace AccessRestrictionEntryStruct {
106
CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
107
0
{
108
0
    return DoEncode(aWriter, aTag, NullOptional);
109
0
}
110
111
CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const
112
0
{
113
0
    return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex));
114
0
}
115
116
CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const
117
0
{
118
0
    bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex);
119
120
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
121
122
0
    if (includeSensitive)
123
0
    {
124
0
        encoder.Encode(to_underlying(Fields::kEndpoint), endpoint);
125
0
    }
126
0
    if (includeSensitive)
127
0
    {
128
0
        encoder.Encode(to_underlying(Fields::kCluster), cluster);
129
0
    }
130
0
    if (includeSensitive)
131
0
    {
132
0
        encoder.Encode(to_underlying(Fields::kRestrictions), restrictions);
133
0
    }
134
0
    if (aAccessingFabricIndex.HasValue())
135
0
    {
136
0
        encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex);
137
0
    }
138
139
0
    return encoder.Finalize();
140
0
}
141
142
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
143
0
{
144
0
    detail::StructDecodeIterator __iterator(reader);
145
0
    while (true)
146
0
    {
147
0
        uint8_t __context_tag = 0;
148
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
149
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
150
0
        ReturnErrorOnFailure(err);
151
152
0
        if (__context_tag == to_underlying(Fields::kEndpoint))
153
0
        {
154
0
            err = DataModel::Decode(reader, endpoint);
155
0
        }
156
0
        else if (__context_tag == to_underlying(Fields::kCluster))
157
0
        {
158
0
            err = DataModel::Decode(reader, cluster);
159
0
        }
160
0
        else if (__context_tag == to_underlying(Fields::kRestrictions))
161
0
        {
162
0
            err = DataModel::Decode(reader, restrictions);
163
0
        }
164
0
        else if (__context_tag == to_underlying(Fields::kFabricIndex))
165
0
        {
166
0
            err = DataModel::Decode(reader, fabricIndex);
167
0
        }
168
169
0
        ReturnErrorOnFailure(err);
170
0
    }
171
0
}
172
173
} // namespace AccessRestrictionEntryStruct
174
175
namespace AccessControlTargetStruct {
176
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
177
0
{
178
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
179
0
    encoder.Encode(to_underlying(Fields::kCluster), cluster);
180
0
    encoder.Encode(to_underlying(Fields::kEndpoint), endpoint);
181
0
    encoder.Encode(to_underlying(Fields::kDeviceType), deviceType);
182
0
    return encoder.Finalize();
183
0
}
184
185
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
186
0
{
187
0
    detail::StructDecodeIterator __iterator(reader);
188
0
    while (true)
189
0
    {
190
0
        uint8_t __context_tag = 0;
191
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
192
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
193
0
        ReturnErrorOnFailure(err);
194
195
0
        if (__context_tag == to_underlying(Fields::kCluster))
196
0
        {
197
0
            err = DataModel::Decode(reader, cluster);
198
0
        }
199
0
        else if (__context_tag == to_underlying(Fields::kEndpoint))
200
0
        {
201
0
            err = DataModel::Decode(reader, endpoint);
202
0
        }
203
0
        else if (__context_tag == to_underlying(Fields::kDeviceType))
204
0
        {
205
0
            err = DataModel::Decode(reader, deviceType);
206
0
        }
207
208
0
        ReturnErrorOnFailure(err);
209
0
    }
210
0
}
211
212
} // namespace AccessControlTargetStruct
213
214
namespace AccessControlEntryStruct {
215
CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
216
0
{
217
0
    return DoEncode(aWriter, aTag, NullOptional);
218
0
}
219
220
CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const
221
0
{
222
0
    return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex));
223
0
}
224
225
CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const
226
0
{
227
0
    bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex);
228
229
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
230
231
0
    if (includeSensitive)
232
0
    {
233
0
        encoder.Encode(to_underlying(Fields::kPrivilege), privilege);
234
0
    }
235
0
    if (includeSensitive)
236
0
    {
237
0
        encoder.Encode(to_underlying(Fields::kAuthMode), authMode);
238
0
    }
239
0
    if (includeSensitive)
240
0
    {
241
0
        encoder.Encode(to_underlying(Fields::kSubjects), subjects);
242
0
    }
243
0
    if (includeSensitive)
244
0
    {
245
0
        encoder.Encode(to_underlying(Fields::kTargets), targets);
246
0
    }
247
0
    if (includeSensitive)
248
0
    {
249
0
        encoder.Encode(to_underlying(Fields::kAuxiliaryType), auxiliaryType);
250
0
    }
251
0
    if (aAccessingFabricIndex.HasValue())
252
0
    {
253
0
        encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex);
254
0
    }
255
256
0
    return encoder.Finalize();
257
0
}
258
259
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
260
0
{
261
0
    detail::StructDecodeIterator __iterator(reader);
262
0
    while (true)
263
0
    {
264
0
        uint8_t __context_tag = 0;
265
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
266
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
267
0
        ReturnErrorOnFailure(err);
268
269
0
        if (__context_tag == to_underlying(Fields::kPrivilege))
270
0
        {
271
0
            err = DataModel::Decode(reader, privilege);
272
0
        }
273
0
        else if (__context_tag == to_underlying(Fields::kAuthMode))
274
0
        {
275
0
            err = DataModel::Decode(reader, authMode);
276
0
        }
277
0
        else if (__context_tag == to_underlying(Fields::kSubjects))
278
0
        {
279
0
            err = DataModel::Decode(reader, subjects);
280
0
        }
281
0
        else if (__context_tag == to_underlying(Fields::kTargets))
282
0
        {
283
0
            err = DataModel::Decode(reader, targets);
284
0
        }
285
0
        else if (__context_tag == to_underlying(Fields::kAuxiliaryType))
286
0
        {
287
0
            err = DataModel::Decode(reader, auxiliaryType);
288
0
        }
289
0
        else if (__context_tag == to_underlying(Fields::kFabricIndex))
290
0
        {
291
0
            err = DataModel::Decode(reader, fabricIndex);
292
0
        }
293
294
0
        ReturnErrorOnFailure(err);
295
0
    }
296
0
}
297
298
} // namespace AccessControlEntryStruct
299
300
namespace AccessControlExtensionStruct {
301
CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
302
0
{
303
0
    return DoEncode(aWriter, aTag, NullOptional);
304
0
}
305
306
CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const
307
0
{
308
0
    return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex));
309
0
}
310
311
CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const
312
0
{
313
0
    bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex);
314
315
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
316
317
0
    if (includeSensitive)
318
0
    {
319
0
        encoder.Encode(to_underlying(Fields::kData), data);
320
0
    }
321
0
    if (aAccessingFabricIndex.HasValue())
322
0
    {
323
0
        encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex);
324
0
    }
325
326
0
    return encoder.Finalize();
327
0
}
328
329
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
330
0
{
331
0
    detail::StructDecodeIterator __iterator(reader);
332
0
    while (true)
333
0
    {
334
0
        uint8_t __context_tag = 0;
335
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
336
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
337
0
        ReturnErrorOnFailure(err);
338
339
0
        if (__context_tag == to_underlying(Fields::kData))
340
0
        {
341
0
            err = DataModel::Decode(reader, data);
342
0
        }
343
0
        else if (__context_tag == to_underlying(Fields::kFabricIndex))
344
0
        {
345
0
            err = DataModel::Decode(reader, fabricIndex);
346
0
        }
347
348
0
        ReturnErrorOnFailure(err);
349
0
    }
350
0
}
351
352
} // namespace AccessControlExtensionStruct
353
} // namespace Structs
354
} // namespace AccessControl
355
} // namespace Clusters
356
} // namespace app
357
} // namespace chip