/src/connectedhomeip/zzz_generated/app-common/clusters/ElectricalPowerMeasurement/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/ElectricalPowerMeasurement/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 ElectricalPowerMeasurement { |
30 | | namespace Structs { |
31 | | |
32 | | namespace HarmonicMeasurementStruct { |
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::kOrder), order); |
37 | 0 | encoder.Encode(to_underlying(Fields::kMeasurement), measurement); |
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::kOrder)) |
52 | 0 | { |
53 | 0 | err = DataModel::Decode(reader, order); |
54 | 0 | } |
55 | 0 | else if (__context_tag == to_underlying(Fields::kMeasurement)) |
56 | 0 | { |
57 | 0 | err = DataModel::Decode(reader, measurement); |
58 | 0 | } |
59 | |
|
60 | 0 | ReturnErrorOnFailure(err); |
61 | 0 | } |
62 | 0 | } |
63 | | |
64 | | } // namespace HarmonicMeasurementStruct |
65 | | |
66 | | namespace MeasurementRangeStruct { |
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::kMeasurementType), measurementType); |
71 | 0 | encoder.Encode(to_underlying(Fields::kMin), min); |
72 | 0 | encoder.Encode(to_underlying(Fields::kMax), max); |
73 | 0 | encoder.Encode(to_underlying(Fields::kStartTimestamp), startTimestamp); |
74 | 0 | encoder.Encode(to_underlying(Fields::kEndTimestamp), endTimestamp); |
75 | 0 | encoder.Encode(to_underlying(Fields::kMinTimestamp), minTimestamp); |
76 | 0 | encoder.Encode(to_underlying(Fields::kMaxTimestamp), maxTimestamp); |
77 | 0 | encoder.Encode(to_underlying(Fields::kStartSystime), startSystime); |
78 | 0 | encoder.Encode(to_underlying(Fields::kEndSystime), endSystime); |
79 | 0 | encoder.Encode(to_underlying(Fields::kMinSystime), minSystime); |
80 | 0 | encoder.Encode(to_underlying(Fields::kMaxSystime), maxSystime); |
81 | 0 | return encoder.Finalize(); |
82 | 0 | } |
83 | | |
84 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
85 | 0 | { |
86 | 0 | detail::StructDecodeIterator __iterator(reader); |
87 | 0 | while (true) |
88 | 0 | { |
89 | 0 | uint8_t __context_tag = 0; |
90 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
91 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
92 | 0 | ReturnErrorOnFailure(err); |
93 | | |
94 | 0 | if (__context_tag == to_underlying(Fields::kMeasurementType)) |
95 | 0 | { |
96 | 0 | err = DataModel::Decode(reader, measurementType); |
97 | 0 | } |
98 | 0 | else if (__context_tag == to_underlying(Fields::kMin)) |
99 | 0 | { |
100 | 0 | err = DataModel::Decode(reader, min); |
101 | 0 | } |
102 | 0 | else if (__context_tag == to_underlying(Fields::kMax)) |
103 | 0 | { |
104 | 0 | err = DataModel::Decode(reader, max); |
105 | 0 | } |
106 | 0 | else if (__context_tag == to_underlying(Fields::kStartTimestamp)) |
107 | 0 | { |
108 | 0 | err = DataModel::Decode(reader, startTimestamp); |
109 | 0 | } |
110 | 0 | else if (__context_tag == to_underlying(Fields::kEndTimestamp)) |
111 | 0 | { |
112 | 0 | err = DataModel::Decode(reader, endTimestamp); |
113 | 0 | } |
114 | 0 | else if (__context_tag == to_underlying(Fields::kMinTimestamp)) |
115 | 0 | { |
116 | 0 | err = DataModel::Decode(reader, minTimestamp); |
117 | 0 | } |
118 | 0 | else if (__context_tag == to_underlying(Fields::kMaxTimestamp)) |
119 | 0 | { |
120 | 0 | err = DataModel::Decode(reader, maxTimestamp); |
121 | 0 | } |
122 | 0 | else if (__context_tag == to_underlying(Fields::kStartSystime)) |
123 | 0 | { |
124 | 0 | err = DataModel::Decode(reader, startSystime); |
125 | 0 | } |
126 | 0 | else if (__context_tag == to_underlying(Fields::kEndSystime)) |
127 | 0 | { |
128 | 0 | err = DataModel::Decode(reader, endSystime); |
129 | 0 | } |
130 | 0 | else if (__context_tag == to_underlying(Fields::kMinSystime)) |
131 | 0 | { |
132 | 0 | err = DataModel::Decode(reader, minSystime); |
133 | 0 | } |
134 | 0 | else if (__context_tag == to_underlying(Fields::kMaxSystime)) |
135 | 0 | { |
136 | 0 | err = DataModel::Decode(reader, maxSystime); |
137 | 0 | } |
138 | |
|
139 | 0 | ReturnErrorOnFailure(err); |
140 | 0 | } |
141 | 0 | } |
142 | | |
143 | | } // namespace MeasurementRangeStruct |
144 | | } // namespace Structs |
145 | | } // namespace ElectricalPowerMeasurement |
146 | | } // namespace Clusters |
147 | | } // namespace app |
148 | | } // namespace chip |