/src/connectedhomeip/zzz_generated/app-common/clusters/ProximityRanging/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/ProximityRanging/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 ProximityRanging { |
30 | | namespace Structs { |
31 | | |
32 | | namespace RDRStruct { |
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::kAzimuth), azimuth); |
37 | 0 | encoder.Encode(to_underlying(Fields::kElevation), elevation); |
38 | 0 | encoder.Encode(to_underlying(Fields::kAzimuthAccuracy), azimuthAccuracy); |
39 | 0 | encoder.Encode(to_underlying(Fields::kElevationAccuracy), elevationAccuracy); |
40 | 0 | encoder.Encode(to_underlying(Fields::kReference), reference); |
41 | 0 | return encoder.Finalize(); |
42 | 0 | } |
43 | | |
44 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
45 | 0 | { |
46 | 0 | detail::StructDecodeIterator __iterator(reader); |
47 | 0 | while (true) |
48 | 0 | { |
49 | 0 | uint8_t __context_tag = 0; |
50 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
51 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
52 | 0 | ReturnErrorOnFailure(err); |
53 | | |
54 | 0 | if (__context_tag == to_underlying(Fields::kAzimuth)) |
55 | 0 | { |
56 | 0 | err = DataModel::Decode(reader, azimuth); |
57 | 0 | } |
58 | 0 | else if (__context_tag == to_underlying(Fields::kElevation)) |
59 | 0 | { |
60 | 0 | err = DataModel::Decode(reader, elevation); |
61 | 0 | } |
62 | 0 | else if (__context_tag == to_underlying(Fields::kAzimuthAccuracy)) |
63 | 0 | { |
64 | 0 | err = DataModel::Decode(reader, azimuthAccuracy); |
65 | 0 | } |
66 | 0 | else if (__context_tag == to_underlying(Fields::kElevationAccuracy)) |
67 | 0 | { |
68 | 0 | err = DataModel::Decode(reader, elevationAccuracy); |
69 | 0 | } |
70 | 0 | else if (__context_tag == to_underlying(Fields::kReference)) |
71 | 0 | { |
72 | 0 | err = DataModel::Decode(reader, reference); |
73 | 0 | } |
74 | |
|
75 | 0 | ReturnErrorOnFailure(err); |
76 | 0 | } |
77 | 0 | } |
78 | | |
79 | | } // namespace RDRStruct |
80 | | |
81 | | namespace RangingMeasurementDataStruct { |
82 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
83 | 0 | { |
84 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
85 | 0 | encoder.Encode(to_underlying(Fields::kWiFiDevIK), wiFiDevIK); |
86 | 0 | encoder.Encode(to_underlying(Fields::kBLEDeviceID), BLEDeviceID); |
87 | 0 | encoder.Encode(to_underlying(Fields::kBLTDevIK), BLTDevIK); |
88 | 0 | encoder.Encode(to_underlying(Fields::kTimeOfMeasurement), timeOfMeasurement); |
89 | 0 | encoder.Encode(to_underlying(Fields::kTimeOfMeasurementOffset), timeOfMeasurementOffset); |
90 | 0 | encoder.Encode(to_underlying(Fields::kDistance), distance); |
91 | 0 | encoder.Encode(to_underlying(Fields::kErrorMargin), errorMargin); |
92 | 0 | encoder.Encode(to_underlying(Fields::kRdr), rdr); |
93 | 0 | encoder.Encode(to_underlying(Fields::kDetectedAttackLevel), detectedAttackLevel); |
94 | 0 | encoder.Encode(to_underlying(Fields::kRssi), rssi); |
95 | 0 | encoder.Encode(to_underlying(Fields::kTxPower), txPower); |
96 | 0 | return encoder.Finalize(); |
97 | 0 | } |
98 | | |
99 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
100 | 0 | { |
101 | 0 | detail::StructDecodeIterator __iterator(reader); |
102 | 0 | while (true) |
103 | 0 | { |
104 | 0 | uint8_t __context_tag = 0; |
105 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
106 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
107 | 0 | ReturnErrorOnFailure(err); |
108 | | |
109 | 0 | if (__context_tag == to_underlying(Fields::kWiFiDevIK)) |
110 | 0 | { |
111 | 0 | err = DataModel::Decode(reader, wiFiDevIK); |
112 | 0 | } |
113 | 0 | else if (__context_tag == to_underlying(Fields::kBLEDeviceID)) |
114 | 0 | { |
115 | 0 | err = DataModel::Decode(reader, BLEDeviceID); |
116 | 0 | } |
117 | 0 | else if (__context_tag == to_underlying(Fields::kBLTDevIK)) |
118 | 0 | { |
119 | 0 | err = DataModel::Decode(reader, BLTDevIK); |
120 | 0 | } |
121 | 0 | else if (__context_tag == to_underlying(Fields::kTimeOfMeasurement)) |
122 | 0 | { |
123 | 0 | err = DataModel::Decode(reader, timeOfMeasurement); |
124 | 0 | } |
125 | 0 | else if (__context_tag == to_underlying(Fields::kTimeOfMeasurementOffset)) |
126 | 0 | { |
127 | 0 | err = DataModel::Decode(reader, timeOfMeasurementOffset); |
128 | 0 | } |
129 | 0 | else if (__context_tag == to_underlying(Fields::kDistance)) |
130 | 0 | { |
131 | 0 | err = DataModel::Decode(reader, distance); |
132 | 0 | } |
133 | 0 | else if (__context_tag == to_underlying(Fields::kErrorMargin)) |
134 | 0 | { |
135 | 0 | err = DataModel::Decode(reader, errorMargin); |
136 | 0 | } |
137 | 0 | else if (__context_tag == to_underlying(Fields::kRdr)) |
138 | 0 | { |
139 | 0 | err = DataModel::Decode(reader, rdr); |
140 | 0 | } |
141 | 0 | else if (__context_tag == to_underlying(Fields::kDetectedAttackLevel)) |
142 | 0 | { |
143 | 0 | err = DataModel::Decode(reader, detectedAttackLevel); |
144 | 0 | } |
145 | 0 | else if (__context_tag == to_underlying(Fields::kRssi)) |
146 | 0 | { |
147 | 0 | err = DataModel::Decode(reader, rssi); |
148 | 0 | } |
149 | 0 | else if (__context_tag == to_underlying(Fields::kTxPower)) |
150 | 0 | { |
151 | 0 | err = DataModel::Decode(reader, txPower); |
152 | 0 | } |
153 | |
|
154 | 0 | ReturnErrorOnFailure(err); |
155 | 0 | } |
156 | 0 | } |
157 | | |
158 | | } // namespace RangingMeasurementDataStruct |
159 | | |
160 | | namespace BLERangingDeviceRoleConfigStruct { |
161 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
162 | 0 | { |
163 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
164 | 0 | encoder.Encode(to_underlying(Fields::kRole), role); |
165 | 0 | encoder.Encode(to_underlying(Fields::kPeerBLEDeviceID), peerBLEDeviceID); |
166 | 0 | return encoder.Finalize(); |
167 | 0 | } |
168 | | |
169 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
170 | 0 | { |
171 | 0 | detail::StructDecodeIterator __iterator(reader); |
172 | 0 | while (true) |
173 | 0 | { |
174 | 0 | uint8_t __context_tag = 0; |
175 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
176 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
177 | 0 | ReturnErrorOnFailure(err); |
178 | | |
179 | 0 | if (__context_tag == to_underlying(Fields::kRole)) |
180 | 0 | { |
181 | 0 | err = DataModel::Decode(reader, role); |
182 | 0 | } |
183 | 0 | else if (__context_tag == to_underlying(Fields::kPeerBLEDeviceID)) |
184 | 0 | { |
185 | 0 | err = DataModel::Decode(reader, peerBLEDeviceID); |
186 | 0 | } |
187 | |
|
188 | 0 | ReturnErrorOnFailure(err); |
189 | 0 | } |
190 | 0 | } |
191 | | |
192 | | } // namespace BLERangingDeviceRoleConfigStruct |
193 | | |
194 | | namespace BLTChannelSoundingDeviceRoleConfigStruct { |
195 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
196 | 0 | { |
197 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
198 | 0 | encoder.Encode(to_underlying(Fields::kRole), role); |
199 | 0 | encoder.Encode(to_underlying(Fields::kPeerBLTDevIK), peerBLTDevIK); |
200 | 0 | encoder.Encode(to_underlying(Fields::kBLTCSMode), BLTCSMode); |
201 | 0 | encoder.Encode(to_underlying(Fields::kBLTCSSecurityLevel), BLTCSSecurityLevel); |
202 | 0 | encoder.Encode(to_underlying(Fields::kLtk), ltk); |
203 | 0 | return encoder.Finalize(); |
204 | 0 | } |
205 | | |
206 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
207 | 0 | { |
208 | 0 | detail::StructDecodeIterator __iterator(reader); |
209 | 0 | while (true) |
210 | 0 | { |
211 | 0 | uint8_t __context_tag = 0; |
212 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
213 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
214 | 0 | ReturnErrorOnFailure(err); |
215 | | |
216 | 0 | if (__context_tag == to_underlying(Fields::kRole)) |
217 | 0 | { |
218 | 0 | err = DataModel::Decode(reader, role); |
219 | 0 | } |
220 | 0 | else if (__context_tag == to_underlying(Fields::kPeerBLTDevIK)) |
221 | 0 | { |
222 | 0 | err = DataModel::Decode(reader, peerBLTDevIK); |
223 | 0 | } |
224 | 0 | else if (__context_tag == to_underlying(Fields::kBLTCSMode)) |
225 | 0 | { |
226 | 0 | err = DataModel::Decode(reader, BLTCSMode); |
227 | 0 | } |
228 | 0 | else if (__context_tag == to_underlying(Fields::kBLTCSSecurityLevel)) |
229 | 0 | { |
230 | 0 | err = DataModel::Decode(reader, BLTCSSecurityLevel); |
231 | 0 | } |
232 | 0 | else if (__context_tag == to_underlying(Fields::kLtk)) |
233 | 0 | { |
234 | 0 | err = DataModel::Decode(reader, ltk); |
235 | 0 | } |
236 | |
|
237 | 0 | ReturnErrorOnFailure(err); |
238 | 0 | } |
239 | 0 | } |
240 | | |
241 | | } // namespace BLTChannelSoundingDeviceRoleConfigStruct |
242 | | |
243 | | namespace RangingCapabilitiesStruct { |
244 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
245 | 0 | { |
246 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
247 | 0 | encoder.Encode(to_underlying(Fields::kTechnology), technology); |
248 | 0 | encoder.Encode(to_underlying(Fields::kFrequencyBand), frequencyBand); |
249 | 0 | encoder.Encode(to_underlying(Fields::kPeriodicRangingSupport), periodicRangingSupport); |
250 | 0 | return encoder.Finalize(); |
251 | 0 | } |
252 | | |
253 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
254 | 0 | { |
255 | 0 | detail::StructDecodeIterator __iterator(reader); |
256 | 0 | while (true) |
257 | 0 | { |
258 | 0 | uint8_t __context_tag = 0; |
259 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
260 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
261 | 0 | ReturnErrorOnFailure(err); |
262 | | |
263 | 0 | if (__context_tag == to_underlying(Fields::kTechnology)) |
264 | 0 | { |
265 | 0 | err = DataModel::Decode(reader, technology); |
266 | 0 | } |
267 | 0 | else if (__context_tag == to_underlying(Fields::kFrequencyBand)) |
268 | 0 | { |
269 | 0 | err = DataModel::Decode(reader, frequencyBand); |
270 | 0 | } |
271 | 0 | else if (__context_tag == to_underlying(Fields::kPeriodicRangingSupport)) |
272 | 0 | { |
273 | 0 | err = DataModel::Decode(reader, periodicRangingSupport); |
274 | 0 | } |
275 | |
|
276 | 0 | ReturnErrorOnFailure(err); |
277 | 0 | } |
278 | 0 | } |
279 | | |
280 | | } // namespace RangingCapabilitiesStruct |
281 | | |
282 | | namespace RangingTriggerConditionStruct { |
283 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
284 | 0 | { |
285 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
286 | 0 | encoder.Encode(to_underlying(Fields::kStartTime), startTime); |
287 | 0 | encoder.Encode(to_underlying(Fields::kEndTime), endTime); |
288 | 0 | encoder.Encode(to_underlying(Fields::kRangingInstanceInterval), rangingInstanceInterval); |
289 | 0 | return encoder.Finalize(); |
290 | 0 | } |
291 | | |
292 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
293 | 0 | { |
294 | 0 | detail::StructDecodeIterator __iterator(reader); |
295 | 0 | while (true) |
296 | 0 | { |
297 | 0 | uint8_t __context_tag = 0; |
298 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
299 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
300 | 0 | ReturnErrorOnFailure(err); |
301 | | |
302 | 0 | 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::kRangingInstanceInterval)) |
311 | 0 | { |
312 | 0 | err = DataModel::Decode(reader, rangingInstanceInterval); |
313 | 0 | } |
314 | |
|
315 | 0 | ReturnErrorOnFailure(err); |
316 | 0 | } |
317 | 0 | } |
318 | | |
319 | | } // namespace RangingTriggerConditionStruct |
320 | | |
321 | | namespace ReportingConditionStruct { |
322 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
323 | 0 | { |
324 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
325 | 0 | encoder.Encode(to_underlying(Fields::kMinDistanceCondition), minDistanceCondition); |
326 | 0 | encoder.Encode(to_underlying(Fields::kMaxDistanceCondition), maxDistanceCondition); |
327 | 0 | encoder.Encode(to_underlying(Fields::kErrorMarginCondition), errorMarginCondition); |
328 | 0 | return encoder.Finalize(); |
329 | 0 | } |
330 | | |
331 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
332 | 0 | { |
333 | 0 | detail::StructDecodeIterator __iterator(reader); |
334 | 0 | while (true) |
335 | 0 | { |
336 | 0 | uint8_t __context_tag = 0; |
337 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
338 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
339 | 0 | ReturnErrorOnFailure(err); |
340 | | |
341 | 0 | if (__context_tag == to_underlying(Fields::kMinDistanceCondition)) |
342 | 0 | { |
343 | 0 | err = DataModel::Decode(reader, minDistanceCondition); |
344 | 0 | } |
345 | 0 | else if (__context_tag == to_underlying(Fields::kMaxDistanceCondition)) |
346 | 0 | { |
347 | 0 | err = DataModel::Decode(reader, maxDistanceCondition); |
348 | 0 | } |
349 | 0 | else if (__context_tag == to_underlying(Fields::kErrorMarginCondition)) |
350 | 0 | { |
351 | 0 | err = DataModel::Decode(reader, errorMarginCondition); |
352 | 0 | } |
353 | |
|
354 | 0 | ReturnErrorOnFailure(err); |
355 | 0 | } |
356 | 0 | } |
357 | | |
358 | | } // namespace ReportingConditionStruct |
359 | | |
360 | | namespace WiFiRangingDeviceRoleConfigStruct { |
361 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
362 | 0 | { |
363 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
364 | 0 | encoder.Encode(to_underlying(Fields::kRole), role); |
365 | 0 | encoder.Encode(to_underlying(Fields::kPeerWiFiDevIK), peerWiFiDevIK); |
366 | 0 | encoder.Encode(to_underlying(Fields::kPmk), pmk); |
367 | 0 | return encoder.Finalize(); |
368 | 0 | } |
369 | | |
370 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
371 | 0 | { |
372 | 0 | detail::StructDecodeIterator __iterator(reader); |
373 | 0 | while (true) |
374 | 0 | { |
375 | 0 | uint8_t __context_tag = 0; |
376 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
377 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
378 | 0 | ReturnErrorOnFailure(err); |
379 | | |
380 | 0 | if (__context_tag == to_underlying(Fields::kRole)) |
381 | 0 | { |
382 | 0 | err = DataModel::Decode(reader, role); |
383 | 0 | } |
384 | 0 | else if (__context_tag == to_underlying(Fields::kPeerWiFiDevIK)) |
385 | 0 | { |
386 | 0 | err = DataModel::Decode(reader, peerWiFiDevIK); |
387 | 0 | } |
388 | 0 | else if (__context_tag == to_underlying(Fields::kPmk)) |
389 | 0 | { |
390 | 0 | err = DataModel::Decode(reader, pmk); |
391 | 0 | } |
392 | |
|
393 | 0 | ReturnErrorOnFailure(err); |
394 | 0 | } |
395 | 0 | } |
396 | | |
397 | | } // namespace WiFiRangingDeviceRoleConfigStruct |
398 | | } // namespace Structs |
399 | | } // namespace ProximityRanging |
400 | | } // namespace Clusters |
401 | | } // namespace app |
402 | | } // namespace chip |