/src/connectedhomeip/zzz_generated/app-common/clusters/DeviceEnergyManagement/Structs.ipp
Line | Count | Source (jump to first uncovered line) |
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/DeviceEnergyManagement/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 DeviceEnergyManagement { |
30 | | namespace Structs { |
31 | | |
32 | | namespace CostStruct { |
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::kCostType), costType); |
37 | 0 | encoder.Encode(to_underlying(Fields::kValue), value); |
38 | 0 | encoder.Encode(to_underlying(Fields::kDecimalPoints), decimalPoints); |
39 | 0 | encoder.Encode(to_underlying(Fields::kCurrency), currency); |
40 | 0 | return encoder.Finalize(); |
41 | 0 | } |
42 | | |
43 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
44 | 0 | { |
45 | 0 | detail::StructDecodeIterator __iterator(reader); |
46 | 0 | while (true) |
47 | 0 | { |
48 | 0 | uint8_t __context_tag = 0; |
49 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
50 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
51 | 0 | ReturnErrorOnFailure(err); |
52 | | |
53 | 0 | if (__context_tag == to_underlying(Fields::kCostType)) |
54 | 0 | { |
55 | 0 | err = DataModel::Decode(reader, costType); |
56 | 0 | } |
57 | 0 | else if (__context_tag == to_underlying(Fields::kValue)) |
58 | 0 | { |
59 | 0 | err = DataModel::Decode(reader, value); |
60 | 0 | } |
61 | 0 | else if (__context_tag == to_underlying(Fields::kDecimalPoints)) |
62 | 0 | { |
63 | 0 | err = DataModel::Decode(reader, decimalPoints); |
64 | 0 | } |
65 | 0 | else if (__context_tag == to_underlying(Fields::kCurrency)) |
66 | 0 | { |
67 | 0 | err = DataModel::Decode(reader, currency); |
68 | 0 | } |
69 | |
|
70 | 0 | ReturnErrorOnFailure(err); |
71 | 0 | } |
72 | 0 | } |
73 | | |
74 | | } // namespace CostStruct |
75 | | |
76 | | namespace PowerAdjustStruct { |
77 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
78 | 0 | { |
79 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
80 | 0 | encoder.Encode(to_underlying(Fields::kMinPower), minPower); |
81 | 0 | encoder.Encode(to_underlying(Fields::kMaxPower), maxPower); |
82 | 0 | encoder.Encode(to_underlying(Fields::kMinDuration), minDuration); |
83 | 0 | encoder.Encode(to_underlying(Fields::kMaxDuration), maxDuration); |
84 | 0 | return encoder.Finalize(); |
85 | 0 | } |
86 | | |
87 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
88 | 0 | { |
89 | 0 | detail::StructDecodeIterator __iterator(reader); |
90 | 0 | while (true) |
91 | 0 | { |
92 | 0 | uint8_t __context_tag = 0; |
93 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
94 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
95 | 0 | ReturnErrorOnFailure(err); |
96 | | |
97 | 0 | if (__context_tag == to_underlying(Fields::kMinPower)) |
98 | 0 | { |
99 | 0 | err = DataModel::Decode(reader, minPower); |
100 | 0 | } |
101 | 0 | else if (__context_tag == to_underlying(Fields::kMaxPower)) |
102 | 0 | { |
103 | 0 | err = DataModel::Decode(reader, maxPower); |
104 | 0 | } |
105 | 0 | else if (__context_tag == to_underlying(Fields::kMinDuration)) |
106 | 0 | { |
107 | 0 | err = DataModel::Decode(reader, minDuration); |
108 | 0 | } |
109 | 0 | else if (__context_tag == to_underlying(Fields::kMaxDuration)) |
110 | 0 | { |
111 | 0 | err = DataModel::Decode(reader, maxDuration); |
112 | 0 | } |
113 | |
|
114 | 0 | ReturnErrorOnFailure(err); |
115 | 0 | } |
116 | 0 | } |
117 | | |
118 | | } // namespace PowerAdjustStruct |
119 | | |
120 | | namespace PowerAdjustCapabilityStruct { |
121 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
122 | 0 | { |
123 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
124 | 0 | encoder.Encode(to_underlying(Fields::kPowerAdjustCapability), powerAdjustCapability); |
125 | 0 | encoder.Encode(to_underlying(Fields::kCause), cause); |
126 | 0 | return encoder.Finalize(); |
127 | 0 | } |
128 | | |
129 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
130 | 0 | { |
131 | 0 | detail::StructDecodeIterator __iterator(reader); |
132 | 0 | while (true) |
133 | 0 | { |
134 | 0 | uint8_t __context_tag = 0; |
135 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
136 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
137 | 0 | ReturnErrorOnFailure(err); |
138 | | |
139 | 0 | if (__context_tag == to_underlying(Fields::kPowerAdjustCapability)) |
140 | 0 | { |
141 | 0 | err = DataModel::Decode(reader, powerAdjustCapability); |
142 | 0 | } |
143 | 0 | else if (__context_tag == to_underlying(Fields::kCause)) |
144 | 0 | { |
145 | 0 | err = DataModel::Decode(reader, cause); |
146 | 0 | } |
147 | |
|
148 | 0 | ReturnErrorOnFailure(err); |
149 | 0 | } |
150 | 0 | } |
151 | | |
152 | | } // namespace PowerAdjustCapabilityStruct |
153 | | |
154 | | namespace SlotStruct { |
155 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
156 | 0 | { |
157 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
158 | 0 | encoder.Encode(to_underlying(Fields::kMinDuration), minDuration); |
159 | 0 | encoder.Encode(to_underlying(Fields::kMaxDuration), maxDuration); |
160 | 0 | encoder.Encode(to_underlying(Fields::kDefaultDuration), defaultDuration); |
161 | 0 | encoder.Encode(to_underlying(Fields::kElapsedSlotTime), elapsedSlotTime); |
162 | 0 | encoder.Encode(to_underlying(Fields::kRemainingSlotTime), remainingSlotTime); |
163 | 0 | encoder.Encode(to_underlying(Fields::kSlotIsPausable), slotIsPausable); |
164 | 0 | encoder.Encode(to_underlying(Fields::kMinPauseDuration), minPauseDuration); |
165 | 0 | encoder.Encode(to_underlying(Fields::kMaxPauseDuration), maxPauseDuration); |
166 | 0 | encoder.Encode(to_underlying(Fields::kManufacturerESAState), manufacturerESAState); |
167 | 0 | encoder.Encode(to_underlying(Fields::kNominalPower), nominalPower); |
168 | 0 | encoder.Encode(to_underlying(Fields::kMinPower), minPower); |
169 | 0 | encoder.Encode(to_underlying(Fields::kMaxPower), maxPower); |
170 | 0 | encoder.Encode(to_underlying(Fields::kNominalEnergy), nominalEnergy); |
171 | 0 | encoder.Encode(to_underlying(Fields::kCosts), costs); |
172 | 0 | encoder.Encode(to_underlying(Fields::kMinPowerAdjustment), minPowerAdjustment); |
173 | 0 | encoder.Encode(to_underlying(Fields::kMaxPowerAdjustment), maxPowerAdjustment); |
174 | 0 | encoder.Encode(to_underlying(Fields::kMinDurationAdjustment), minDurationAdjustment); |
175 | 0 | encoder.Encode(to_underlying(Fields::kMaxDurationAdjustment), maxDurationAdjustment); |
176 | 0 | return encoder.Finalize(); |
177 | 0 | } |
178 | | |
179 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
180 | 0 | { |
181 | 0 | detail::StructDecodeIterator __iterator(reader); |
182 | 0 | while (true) |
183 | 0 | { |
184 | 0 | uint8_t __context_tag = 0; |
185 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
186 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
187 | 0 | ReturnErrorOnFailure(err); |
188 | | |
189 | 0 | if (__context_tag == to_underlying(Fields::kMinDuration)) |
190 | 0 | { |
191 | 0 | err = DataModel::Decode(reader, minDuration); |
192 | 0 | } |
193 | 0 | else if (__context_tag == to_underlying(Fields::kMaxDuration)) |
194 | 0 | { |
195 | 0 | err = DataModel::Decode(reader, maxDuration); |
196 | 0 | } |
197 | 0 | else if (__context_tag == to_underlying(Fields::kDefaultDuration)) |
198 | 0 | { |
199 | 0 | err = DataModel::Decode(reader, defaultDuration); |
200 | 0 | } |
201 | 0 | else if (__context_tag == to_underlying(Fields::kElapsedSlotTime)) |
202 | 0 | { |
203 | 0 | err = DataModel::Decode(reader, elapsedSlotTime); |
204 | 0 | } |
205 | 0 | else if (__context_tag == to_underlying(Fields::kRemainingSlotTime)) |
206 | 0 | { |
207 | 0 | err = DataModel::Decode(reader, remainingSlotTime); |
208 | 0 | } |
209 | 0 | else if (__context_tag == to_underlying(Fields::kSlotIsPausable)) |
210 | 0 | { |
211 | 0 | err = DataModel::Decode(reader, slotIsPausable); |
212 | 0 | } |
213 | 0 | else if (__context_tag == to_underlying(Fields::kMinPauseDuration)) |
214 | 0 | { |
215 | 0 | err = DataModel::Decode(reader, minPauseDuration); |
216 | 0 | } |
217 | 0 | else if (__context_tag == to_underlying(Fields::kMaxPauseDuration)) |
218 | 0 | { |
219 | 0 | err = DataModel::Decode(reader, maxPauseDuration); |
220 | 0 | } |
221 | 0 | else if (__context_tag == to_underlying(Fields::kManufacturerESAState)) |
222 | 0 | { |
223 | 0 | err = DataModel::Decode(reader, manufacturerESAState); |
224 | 0 | } |
225 | 0 | else if (__context_tag == to_underlying(Fields::kNominalPower)) |
226 | 0 | { |
227 | 0 | err = DataModel::Decode(reader, nominalPower); |
228 | 0 | } |
229 | 0 | else if (__context_tag == to_underlying(Fields::kMinPower)) |
230 | 0 | { |
231 | 0 | err = DataModel::Decode(reader, minPower); |
232 | 0 | } |
233 | 0 | else if (__context_tag == to_underlying(Fields::kMaxPower)) |
234 | 0 | { |
235 | 0 | err = DataModel::Decode(reader, maxPower); |
236 | 0 | } |
237 | 0 | else if (__context_tag == to_underlying(Fields::kNominalEnergy)) |
238 | 0 | { |
239 | 0 | err = DataModel::Decode(reader, nominalEnergy); |
240 | 0 | } |
241 | 0 | else if (__context_tag == to_underlying(Fields::kCosts)) |
242 | 0 | { |
243 | 0 | err = DataModel::Decode(reader, costs); |
244 | 0 | } |
245 | 0 | else if (__context_tag == to_underlying(Fields::kMinPowerAdjustment)) |
246 | 0 | { |
247 | 0 | err = DataModel::Decode(reader, minPowerAdjustment); |
248 | 0 | } |
249 | 0 | else if (__context_tag == to_underlying(Fields::kMaxPowerAdjustment)) |
250 | 0 | { |
251 | 0 | err = DataModel::Decode(reader, maxPowerAdjustment); |
252 | 0 | } |
253 | 0 | else if (__context_tag == to_underlying(Fields::kMinDurationAdjustment)) |
254 | 0 | { |
255 | 0 | err = DataModel::Decode(reader, minDurationAdjustment); |
256 | 0 | } |
257 | 0 | else if (__context_tag == to_underlying(Fields::kMaxDurationAdjustment)) |
258 | 0 | { |
259 | 0 | err = DataModel::Decode(reader, maxDurationAdjustment); |
260 | 0 | } |
261 | |
|
262 | 0 | ReturnErrorOnFailure(err); |
263 | 0 | } |
264 | 0 | } |
265 | | |
266 | | } // namespace SlotStruct |
267 | | |
268 | | namespace ForecastStruct { |
269 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
270 | 0 | { |
271 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
272 | 0 | encoder.Encode(to_underlying(Fields::kForecastID), forecastID); |
273 | 0 | encoder.Encode(to_underlying(Fields::kActiveSlotNumber), activeSlotNumber); |
274 | 0 | encoder.Encode(to_underlying(Fields::kStartTime), startTime); |
275 | 0 | encoder.Encode(to_underlying(Fields::kEndTime), endTime); |
276 | 0 | encoder.Encode(to_underlying(Fields::kEarliestStartTime), earliestStartTime); |
277 | 0 | encoder.Encode(to_underlying(Fields::kLatestEndTime), latestEndTime); |
278 | 0 | encoder.Encode(to_underlying(Fields::kIsPausable), isPausable); |
279 | 0 | encoder.Encode(to_underlying(Fields::kSlots), slots); |
280 | 0 | encoder.Encode(to_underlying(Fields::kForecastUpdateReason), forecastUpdateReason); |
281 | 0 | return encoder.Finalize(); |
282 | 0 | } |
283 | | |
284 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
285 | 0 | { |
286 | 0 | detail::StructDecodeIterator __iterator(reader); |
287 | 0 | while (true) |
288 | 0 | { |
289 | 0 | uint8_t __context_tag = 0; |
290 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
291 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
292 | 0 | ReturnErrorOnFailure(err); |
293 | | |
294 | 0 | if (__context_tag == to_underlying(Fields::kForecastID)) |
295 | 0 | { |
296 | 0 | err = DataModel::Decode(reader, forecastID); |
297 | 0 | } |
298 | 0 | else if (__context_tag == to_underlying(Fields::kActiveSlotNumber)) |
299 | 0 | { |
300 | 0 | err = DataModel::Decode(reader, activeSlotNumber); |
301 | 0 | } |
302 | 0 | else if (__context_tag == to_underlying(Fields::kStartTime)) |
303 | 0 | { |
304 | 0 | err = DataModel::Decode(reader, startTime); |
305 | 0 | } |
306 | 0 | else if (__context_tag == to_underlying(Fields::kEndTime)) |
307 | 0 | { |
308 | 0 | err = DataModel::Decode(reader, endTime); |
309 | 0 | } |
310 | 0 | else if (__context_tag == to_underlying(Fields::kEarliestStartTime)) |
311 | 0 | { |
312 | 0 | err = DataModel::Decode(reader, earliestStartTime); |
313 | 0 | } |
314 | 0 | else if (__context_tag == to_underlying(Fields::kLatestEndTime)) |
315 | 0 | { |
316 | 0 | err = DataModel::Decode(reader, latestEndTime); |
317 | 0 | } |
318 | 0 | else if (__context_tag == to_underlying(Fields::kIsPausable)) |
319 | 0 | { |
320 | 0 | err = DataModel::Decode(reader, isPausable); |
321 | 0 | } |
322 | 0 | else if (__context_tag == to_underlying(Fields::kSlots)) |
323 | 0 | { |
324 | 0 | err = DataModel::Decode(reader, slots); |
325 | 0 | } |
326 | 0 | else if (__context_tag == to_underlying(Fields::kForecastUpdateReason)) |
327 | 0 | { |
328 | 0 | err = DataModel::Decode(reader, forecastUpdateReason); |
329 | 0 | } |
330 | |
|
331 | 0 | ReturnErrorOnFailure(err); |
332 | 0 | } |
333 | 0 | } |
334 | | |
335 | | } // namespace ForecastStruct |
336 | | |
337 | | namespace ConstraintsStruct { |
338 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
339 | 0 | { |
340 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
341 | 0 | encoder.Encode(to_underlying(Fields::kStartTime), startTime); |
342 | 0 | encoder.Encode(to_underlying(Fields::kDuration), duration); |
343 | 0 | encoder.Encode(to_underlying(Fields::kNominalPower), nominalPower); |
344 | 0 | encoder.Encode(to_underlying(Fields::kMaximumEnergy), maximumEnergy); |
345 | 0 | encoder.Encode(to_underlying(Fields::kLoadControl), loadControl); |
346 | 0 | return encoder.Finalize(); |
347 | 0 | } |
348 | | |
349 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
350 | 0 | { |
351 | 0 | detail::StructDecodeIterator __iterator(reader); |
352 | 0 | while (true) |
353 | 0 | { |
354 | 0 | uint8_t __context_tag = 0; |
355 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
356 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
357 | 0 | ReturnErrorOnFailure(err); |
358 | | |
359 | 0 | if (__context_tag == to_underlying(Fields::kStartTime)) |
360 | 0 | { |
361 | 0 | err = DataModel::Decode(reader, startTime); |
362 | 0 | } |
363 | 0 | else if (__context_tag == to_underlying(Fields::kDuration)) |
364 | 0 | { |
365 | 0 | err = DataModel::Decode(reader, duration); |
366 | 0 | } |
367 | 0 | else if (__context_tag == to_underlying(Fields::kNominalPower)) |
368 | 0 | { |
369 | 0 | err = DataModel::Decode(reader, nominalPower); |
370 | 0 | } |
371 | 0 | else if (__context_tag == to_underlying(Fields::kMaximumEnergy)) |
372 | 0 | { |
373 | 0 | err = DataModel::Decode(reader, maximumEnergy); |
374 | 0 | } |
375 | 0 | else if (__context_tag == to_underlying(Fields::kLoadControl)) |
376 | 0 | { |
377 | 0 | err = DataModel::Decode(reader, loadControl); |
378 | 0 | } |
379 | |
|
380 | 0 | ReturnErrorOnFailure(err); |
381 | 0 | } |
382 | 0 | } |
383 | | |
384 | | } // namespace ConstraintsStruct |
385 | | |
386 | | namespace SlotAdjustmentStruct { |
387 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
388 | 0 | { |
389 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
390 | 0 | encoder.Encode(to_underlying(Fields::kSlotIndex), slotIndex); |
391 | 0 | encoder.Encode(to_underlying(Fields::kNominalPower), nominalPower); |
392 | 0 | encoder.Encode(to_underlying(Fields::kDuration), duration); |
393 | 0 | return encoder.Finalize(); |
394 | 0 | } |
395 | | |
396 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
397 | 0 | { |
398 | 0 | detail::StructDecodeIterator __iterator(reader); |
399 | 0 | while (true) |
400 | 0 | { |
401 | 0 | uint8_t __context_tag = 0; |
402 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
403 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
404 | 0 | ReturnErrorOnFailure(err); |
405 | | |
406 | 0 | if (__context_tag == to_underlying(Fields::kSlotIndex)) |
407 | 0 | { |
408 | 0 | err = DataModel::Decode(reader, slotIndex); |
409 | 0 | } |
410 | 0 | else if (__context_tag == to_underlying(Fields::kNominalPower)) |
411 | 0 | { |
412 | 0 | err = DataModel::Decode(reader, nominalPower); |
413 | 0 | } |
414 | 0 | else if (__context_tag == to_underlying(Fields::kDuration)) |
415 | 0 | { |
416 | 0 | err = DataModel::Decode(reader, duration); |
417 | 0 | } |
418 | |
|
419 | 0 | ReturnErrorOnFailure(err); |
420 | 0 | } |
421 | 0 | } |
422 | | |
423 | | } // namespace SlotAdjustmentStruct |
424 | | } // namespace Structs |
425 | | } // namespace DeviceEnergyManagement |
426 | | } // namespace Clusters |
427 | | } // namespace app |
428 | | } // namespace chip |