Coverage Report

Created: 2026-02-12 06:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/connectedhomeip/zzz_generated/app-common/clusters/shared/Structs.h
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-shared-Structs.h.zapt
20
21
#pragma once
22
23
#include <app/data-model/DecodableList.h>
24
#include <app/data-model/List.h>
25
#include <app/data-model/Nullable.h>
26
#include <lib/core/CHIPError.h>
27
#include <lib/core/DataModelTypes.h>
28
#include <lib/core/Optional.h>
29
#include <lib/core/TLV.h>
30
#include <lib/support/BitMask.h>
31
32
#include <clusters/shared/Enums.h>
33
34
#include <cstdint>
35
36
namespace chip {
37
namespace app {
38
namespace Clusters {
39
40
// Structs shared across multiple clusters.
41
namespace detail {
42
namespace Structs {
43
44
namespace ModeTagStruct {
45
enum class Fields : uint8_t
46
{
47
    kMfgCode = 0,
48
    kValue   = 1,
49
};
50
51
struct Type
52
{
53
public:
54
    Optional<chip::VendorId> mfgCode;
55
    uint16_t value = static_cast<uint16_t>(0);
56
57
    CHIP_ERROR Decode(TLV::TLVReader & reader);
58
59
    static constexpr bool kIsFabricScoped = false;
60
61
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
62
};
63
64
using DecodableType = Type;
65
66
} // namespace ModeTagStruct
67
namespace ModeOptionStruct {
68
enum class Fields : uint8_t
69
{
70
    kLabel    = 0,
71
    kMode     = 1,
72
    kModeTags = 2,
73
};
74
75
struct Type
76
{
77
public:
78
    chip::CharSpan label;
79
    uint8_t mode = static_cast<uint8_t>(0);
80
    DataModel::List<const Structs::ModeTagStruct::Type> modeTags;
81
82
    static constexpr bool kIsFabricScoped = false;
83
84
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
85
};
86
87
struct DecodableType
88
{
89
public:
90
    chip::CharSpan label;
91
    uint8_t mode = static_cast<uint8_t>(0);
92
    DataModel::DecodableList<Structs::ModeTagStruct::DecodableType> modeTags;
93
94
    CHIP_ERROR Decode(TLV::TLVReader & reader);
95
96
    static constexpr bool kIsFabricScoped = false;
97
};
98
99
} // namespace ModeOptionStruct
100
namespace MeasurementAccuracyRangeStruct {
101
enum class Fields : uint8_t
102
{
103
    kRangeMin       = 0,
104
    kRangeMax       = 1,
105
    kPercentMax     = 2,
106
    kPercentMin     = 3,
107
    kPercentTypical = 4,
108
    kFixedMax       = 5,
109
    kFixedMin       = 6,
110
    kFixedTypical   = 7,
111
};
112
113
struct Type
114
{
115
public:
116
    int64_t rangeMin = static_cast<int64_t>(0);
117
    int64_t rangeMax = static_cast<int64_t>(0);
118
    Optional<chip::Percent100ths> percentMax;
119
    Optional<chip::Percent100ths> percentMin;
120
    Optional<chip::Percent100ths> percentTypical;
121
    Optional<uint64_t> fixedMax;
122
    Optional<uint64_t> fixedMin;
123
    Optional<uint64_t> fixedTypical;
124
125
    CHIP_ERROR Decode(TLV::TLVReader & reader);
126
127
    static constexpr bool kIsFabricScoped = false;
128
129
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
130
};
131
132
using DecodableType = Type;
133
134
} // namespace MeasurementAccuracyRangeStruct
135
namespace MeasurementAccuracyStruct {
136
enum class Fields : uint8_t
137
{
138
    kMeasurementType  = 0,
139
    kMeasured         = 1,
140
    kMinMeasuredValue = 2,
141
    kMaxMeasuredValue = 3,
142
    kAccuracyRanges   = 4,
143
};
144
145
struct Type
146
{
147
public:
148
    MeasurementTypeEnum measurementType = static_cast<MeasurementTypeEnum>(0);
149
    bool measured                       = static_cast<bool>(0);
150
    int64_t minMeasuredValue            = static_cast<int64_t>(0);
151
    int64_t maxMeasuredValue            = static_cast<int64_t>(0);
152
    DataModel::List<const Structs::MeasurementAccuracyRangeStruct::Type> accuracyRanges;
153
154
    static constexpr bool kIsFabricScoped = false;
155
156
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
157
};
158
159
struct DecodableType
160
{
161
public:
162
    MeasurementTypeEnum measurementType = static_cast<MeasurementTypeEnum>(0);
163
    bool measured                       = static_cast<bool>(0);
164
    int64_t minMeasuredValue            = static_cast<int64_t>(0);
165
    int64_t maxMeasuredValue            = static_cast<int64_t>(0);
166
    DataModel::DecodableList<Structs::MeasurementAccuracyRangeStruct::DecodableType> accuracyRanges;
167
168
    CHIP_ERROR Decode(TLV::TLVReader & reader);
169
170
    static constexpr bool kIsFabricScoped = false;
171
};
172
173
} // namespace MeasurementAccuracyStruct
174
namespace ErrorStateStruct {
175
enum class Fields : uint8_t
176
{
177
    kErrorStateID      = 0,
178
    kErrorStateLabel   = 1,
179
    kErrorStateDetails = 2,
180
};
181
182
struct Type
183
{
184
public:
185
    uint8_t errorStateID = static_cast<uint8_t>(0);
186
    Optional<chip::CharSpan> errorStateLabel;
187
    Optional<chip::CharSpan> errorStateDetails;
188
189
    CHIP_ERROR Decode(TLV::TLVReader & reader);
190
191
    static constexpr bool kIsFabricScoped = false;
192
193
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
194
};
195
196
using DecodableType = Type;
197
198
} // namespace ErrorStateStruct
199
namespace LabelStruct {
200
enum class Fields : uint8_t
201
{
202
    kLabel = 0,
203
    kValue = 1,
204
};
205
206
struct Type
207
{
208
public:
209
    chip::CharSpan label;
210
    chip::CharSpan value;
211
212
    CHIP_ERROR Decode(TLV::TLVReader & reader);
213
214
    static constexpr bool kIsFabricScoped = false;
215
216
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
217
};
218
219
using DecodableType = Type;
220
221
} // namespace LabelStruct
222
namespace OperationalStateStruct {
223
enum class Fields : uint8_t
224
{
225
    kOperationalStateID    = 0,
226
    kOperationalStateLabel = 1,
227
};
228
229
struct Type
230
{
231
public:
232
    uint8_t operationalStateID = static_cast<uint8_t>(0);
233
    Optional<chip::CharSpan> operationalStateLabel;
234
235
    CHIP_ERROR Decode(TLV::TLVReader & reader);
236
237
    static constexpr bool kIsFabricScoped = false;
238
239
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
240
};
241
242
using DecodableType = Type;
243
244
} // namespace OperationalStateStruct
245
} // namespace Structs
246
} // namespace detail
247
248
// Global structs.
249
namespace Globals {
250
namespace Structs {
251
252
namespace CurrencyStruct {
253
enum class Fields : uint8_t
254
{
255
    kCurrency      = 0,
256
    kDecimalPoints = 1,
257
};
258
259
struct Type
260
{
261
public:
262
    uint16_t currency     = static_cast<uint16_t>(0);
263
    uint8_t decimalPoints = static_cast<uint8_t>(0);
264
265
    CHIP_ERROR Decode(TLV::TLVReader & reader);
266
267
    static constexpr bool kIsFabricScoped = false;
268
269
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
270
};
271
272
using DecodableType = Type;
273
274
} // namespace CurrencyStruct
275
276
namespace PriceStruct {
277
enum class Fields : uint8_t
278
{
279
    kAmount   = 0,
280
    kCurrency = 1,
281
};
282
283
struct Type
284
{
285
public:
286
    int64_t amount = static_cast<int64_t>(0);
287
    Globals::Structs::CurrencyStruct::Type currency;
288
289
    CHIP_ERROR Decode(TLV::TLVReader & reader);
290
291
    static constexpr bool kIsFabricScoped = false;
292
293
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
294
};
295
296
using DecodableType = Type;
297
298
} // namespace PriceStruct
299
300
namespace MeasurementAccuracyRangeStruct {
301
enum class Fields : uint8_t
302
{
303
    kRangeMin       = 0,
304
    kRangeMax       = 1,
305
    kPercentMax     = 2,
306
    kPercentMin     = 3,
307
    kPercentTypical = 4,
308
    kFixedMax       = 5,
309
    kFixedMin       = 6,
310
    kFixedTypical   = 7,
311
};
312
313
struct Type
314
{
315
public:
316
    int64_t rangeMin = static_cast<int64_t>(0);
317
    int64_t rangeMax = static_cast<int64_t>(0);
318
    Optional<chip::Percent100ths> percentMax;
319
    Optional<chip::Percent100ths> percentMin;
320
    Optional<chip::Percent100ths> percentTypical;
321
    Optional<uint64_t> fixedMax;
322
    Optional<uint64_t> fixedMin;
323
    Optional<uint64_t> fixedTypical;
324
325
    CHIP_ERROR Decode(TLV::TLVReader & reader);
326
327
    static constexpr bool kIsFabricScoped = false;
328
329
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
330
};
331
332
using DecodableType = Type;
333
334
} // namespace MeasurementAccuracyRangeStruct
335
336
namespace MeasurementAccuracyStruct {
337
enum class Fields : uint8_t
338
{
339
    kMeasurementType  = 0,
340
    kMeasured         = 1,
341
    kMinMeasuredValue = 2,
342
    kMaxMeasuredValue = 3,
343
    kAccuracyRanges   = 4,
344
};
345
346
struct Type
347
{
348
public:
349
    Globals::MeasurementTypeEnum measurementType = static_cast<Globals::MeasurementTypeEnum>(0);
350
    bool measured                                = static_cast<bool>(0);
351
    int64_t minMeasuredValue                     = static_cast<int64_t>(0);
352
    int64_t maxMeasuredValue                     = static_cast<int64_t>(0);
353
    DataModel::List<const Globals::Structs::MeasurementAccuracyRangeStruct::Type> accuracyRanges;
354
355
    static constexpr bool kIsFabricScoped = false;
356
357
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
358
};
359
360
struct DecodableType
361
{
362
public:
363
    Globals::MeasurementTypeEnum measurementType = static_cast<Globals::MeasurementTypeEnum>(0);
364
    bool measured                                = static_cast<bool>(0);
365
    int64_t minMeasuredValue                     = static_cast<int64_t>(0);
366
    int64_t maxMeasuredValue                     = static_cast<int64_t>(0);
367
    DataModel::DecodableList<Globals::Structs::MeasurementAccuracyRangeStruct::DecodableType> accuracyRanges;
368
369
    CHIP_ERROR Decode(TLV::TLVReader & reader);
370
371
    static constexpr bool kIsFabricScoped = false;
372
};
373
374
} // namespace MeasurementAccuracyStruct
375
376
namespace AtomicAttributeStatusStruct {
377
enum class Fields : uint8_t
378
{
379
    kAttributeID = 0,
380
    kStatusCode  = 1,
381
};
382
383
struct Type
384
{
385
public:
386
    chip::AttributeId attributeID = static_cast<chip::AttributeId>(0);
387
    uint8_t statusCode            = static_cast<uint8_t>(0);
388
389
    CHIP_ERROR Decode(TLV::TLVReader & reader);
390
391
    static constexpr bool kIsFabricScoped = false;
392
393
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
394
};
395
396
using DecodableType = Type;
397
398
} // namespace AtomicAttributeStatusStruct
399
400
namespace ICECandidateStruct {
401
enum class Fields : uint8_t
402
{
403
    kCandidate     = 0,
404
    kSDPMid        = 1,
405
    kSDPMLineIndex = 2,
406
};
407
408
struct Type
409
{
410
public:
411
    chip::CharSpan candidate;
412
    DataModel::Nullable<chip::CharSpan> SDPMid;
413
    DataModel::Nullable<uint16_t> SDPMLineIndex;
414
415
    CHIP_ERROR Decode(TLV::TLVReader & reader);
416
417
    static constexpr bool kIsFabricScoped = false;
418
419
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
420
};
421
422
using DecodableType = Type;
423
424
} // namespace ICECandidateStruct
425
426
namespace ICEServerStruct {
427
enum class Fields : uint8_t
428
{
429
    kURLs       = 0,
430
    kUsername   = 1,
431
    kCredential = 2,
432
    kCaid       = 3,
433
};
434
435
struct Type
436
{
437
public:
438
    DataModel::List<const chip::CharSpan> URLs;
439
    Optional<chip::CharSpan> username;
440
    Optional<chip::CharSpan> credential;
441
    Optional<uint16_t> caid;
442
443
    static constexpr bool kIsFabricScoped = false;
444
445
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
446
};
447
448
struct DecodableType
449
{
450
public:
451
    DataModel::DecodableList<chip::CharSpan> URLs;
452
    Optional<chip::CharSpan> username;
453
    Optional<chip::CharSpan> credential;
454
    Optional<uint16_t> caid;
455
456
    CHIP_ERROR Decode(TLV::TLVReader & reader);
457
458
    static constexpr bool kIsFabricScoped = false;
459
};
460
461
} // namespace ICEServerStruct
462
463
namespace LocationDescriptorStruct {
464
enum class Fields : uint8_t
465
{
466
    kLocationName = 0,
467
    kFloorNumber  = 1,
468
    kAreaType     = 2,
469
};
470
471
struct Type
472
{
473
public:
474
    chip::CharSpan locationName;
475
    DataModel::Nullable<int16_t> floorNumber;
476
    DataModel::Nullable<Globals::AreaTypeTag> areaType;
477
478
    CHIP_ERROR Decode(TLV::TLVReader & reader);
479
480
    static constexpr bool kIsFabricScoped = false;
481
482
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
483
};
484
485
using DecodableType = Type;
486
487
} // namespace LocationDescriptorStruct
488
489
namespace PowerThresholdStruct {
490
enum class Fields : uint8_t
491
{
492
    kPowerThreshold         = 0,
493
    kApparentPowerThreshold = 1,
494
    kPowerThresholdSource   = 2,
495
};
496
497
struct Type
498
{
499
public:
500
    Optional<int64_t> powerThreshold;
501
    Optional<int64_t> apparentPowerThreshold;
502
    DataModel::Nullable<Globals::PowerThresholdSourceEnum> powerThresholdSource;
503
504
    CHIP_ERROR Decode(TLV::TLVReader & reader);
505
506
    static constexpr bool kIsFabricScoped = false;
507
508
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
509
};
510
511
using DecodableType = Type;
512
513
} // namespace PowerThresholdStruct
514
515
namespace SemanticTagStruct {
516
enum class Fields : uint8_t
517
{
518
    kMfgCode     = 0,
519
    kNamespaceID = 1,
520
    kTag         = 2,
521
    kLabel       = 3,
522
};
523
524
struct Type
525
{
526
public:
527
    DataModel::Nullable<chip::VendorId> mfgCode;
528
    uint8_t namespaceID = static_cast<uint8_t>(0);
529
    uint8_t tag         = static_cast<uint8_t>(0);
530
    Optional<DataModel::Nullable<chip::CharSpan>> label;
531
532
    CHIP_ERROR Decode(TLV::TLVReader & reader);
533
534
    static constexpr bool kIsFabricScoped = false;
535
536
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
537
};
538
539
using DecodableType = Type;
540
541
} // namespace SemanticTagStruct
542
543
namespace TestGlobalStruct {
544
enum class Fields : uint8_t
545
{
546
    kName     = 0,
547
    kMyBitmap = 1,
548
    kMyEnum   = 2,
549
};
550
551
struct Type
552
{
553
public:
554
    chip::CharSpan name;
555
    DataModel::Nullable<chip::BitMask<Globals::TestGlobalBitmap>> myBitmap;
556
    Optional<DataModel::Nullable<Globals::TestGlobalEnum>> myEnum;
557
558
    CHIP_ERROR Decode(TLV::TLVReader & reader);
559
560
    static constexpr bool kIsFabricScoped = false;
561
562
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
563
};
564
565
using DecodableType = Type;
566
567
} // namespace TestGlobalStruct
568
569
namespace ViewportStruct {
570
enum class Fields : uint8_t
571
{
572
    kX1 = 0,
573
    kY1 = 1,
574
    kX2 = 2,
575
    kY2 = 3,
576
};
577
578
struct Type
579
{
580
public:
581
    uint16_t x1 = static_cast<uint16_t>(0);
582
    uint16_t y1 = static_cast<uint16_t>(0);
583
    uint16_t x2 = static_cast<uint16_t>(0);
584
    uint16_t y2 = static_cast<uint16_t>(0);
585
586
    CHIP_ERROR Decode(TLV::TLVReader & reader);
587
588
    static constexpr bool kIsFabricScoped = false;
589
590
    CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
591
};
592
593
using DecodableType = Type;
594
595
} // namespace ViewportStruct
596
597
namespace WebRTCSessionStruct {
598
enum class Fields : uint8_t
599
{
600
    kId              = 0,
601
    kPeerNodeID      = 1,
602
    kPeerEndpointID  = 2,
603
    kStreamUsage     = 3,
604
    kVideoStreamID   = 4,
605
    kAudioStreamID   = 5,
606
    kMetadataEnabled = 6,
607
    kVideoStreams    = 7,
608
    kAudioStreams    = 8,
609
    kFabricIndex     = 254,
610
};
611
612
struct Type
613
{
614
public:
615
    uint16_t id                          = static_cast<uint16_t>(0);
616
    chip::NodeId peerNodeID              = static_cast<chip::NodeId>(0);
617
    chip::EndpointId peerEndpointID      = static_cast<chip::EndpointId>(0);
618
    Globals::StreamUsageEnum streamUsage = static_cast<Globals::StreamUsageEnum>(0);
619
    DataModel::Nullable<uint16_t> videoStreamID;
620
    DataModel::Nullable<uint16_t> audioStreamID;
621
    bool metadataEnabled = static_cast<bool>(0);
622
    Optional<DataModel::List<const uint16_t>> videoStreams;
623
    Optional<DataModel::List<const uint16_t>> audioStreams;
624
    chip::FabricIndex fabricIndex = static_cast<chip::FabricIndex>(0);
625
626
    static constexpr bool kIsFabricScoped = true;
627
628
0
    auto GetFabricIndex() const { return fabricIndex; }
629
630
0
    void SetFabricIndex(chip::FabricIndex fabricIndex_) { fabricIndex = fabricIndex_; }
631
632
    CHIP_ERROR EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
633
    CHIP_ERROR EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const;
634
635
private:
636
    CHIP_ERROR DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const;
637
};
638
639
struct DecodableType
640
{
641
public:
642
    uint16_t id                          = static_cast<uint16_t>(0);
643
    chip::NodeId peerNodeID              = static_cast<chip::NodeId>(0);
644
    chip::EndpointId peerEndpointID      = static_cast<chip::EndpointId>(0);
645
    Globals::StreamUsageEnum streamUsage = static_cast<Globals::StreamUsageEnum>(0);
646
    DataModel::Nullable<uint16_t> videoStreamID;
647
    DataModel::Nullable<uint16_t> audioStreamID;
648
    bool metadataEnabled = static_cast<bool>(0);
649
    Optional<DataModel::DecodableList<uint16_t>> videoStreams;
650
    Optional<DataModel::DecodableList<uint16_t>> audioStreams;
651
    chip::FabricIndex fabricIndex = static_cast<chip::FabricIndex>(0);
652
653
    CHIP_ERROR Decode(TLV::TLVReader & reader);
654
655
    static constexpr bool kIsFabricScoped = true;
656
657
0
    auto GetFabricIndex() const { return fabricIndex; }
658
659
0
    void SetFabricIndex(chip::FabricIndex fabricIndex_) { fabricIndex = fabricIndex_; }
660
};
661
662
} // namespace WebRTCSessionStruct
663
664
} // namespace Structs
665
} // namespace Globals
666
} // namespace Clusters
667
} // namespace app
668
} // namespace chip