/src/connectedhomeip/zzz_generated/app-common/clusters/GroupKeyManagement/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/GroupKeyManagement/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 GroupKeyManagement { |
30 | | namespace Structs { |
31 | | |
32 | | namespace GroupInfoMapStruct { |
33 | | CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
34 | 0 | { |
35 | 0 | return DoEncode(aWriter, aTag, NullOptional); |
36 | 0 | } |
37 | | |
38 | | CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const |
39 | 0 | { |
40 | 0 | return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); |
41 | 0 | } |
42 | | |
43 | | CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const |
44 | 0 | { |
45 | |
|
46 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
47 | |
|
48 | 0 | encoder.Encode(to_underlying(Fields::kGroupId), groupId); |
49 | 0 | encoder.Encode(to_underlying(Fields::kEndpoints), endpoints); |
50 | 0 | encoder.Encode(to_underlying(Fields::kGroupName), groupName); |
51 | 0 | if (aAccessingFabricIndex.HasValue()) |
52 | 0 | { |
53 | 0 | encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); |
54 | 0 | } |
55 | |
|
56 | 0 | return encoder.Finalize(); |
57 | 0 | } |
58 | | |
59 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
60 | 0 | { |
61 | 0 | detail::StructDecodeIterator __iterator(reader); |
62 | 0 | while (true) |
63 | 0 | { |
64 | 0 | uint8_t __context_tag = 0; |
65 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
66 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
67 | 0 | ReturnErrorOnFailure(err); |
68 | | |
69 | 0 | if (__context_tag == to_underlying(Fields::kGroupId)) |
70 | 0 | { |
71 | 0 | err = DataModel::Decode(reader, groupId); |
72 | 0 | } |
73 | 0 | else if (__context_tag == to_underlying(Fields::kEndpoints)) |
74 | 0 | { |
75 | 0 | err = DataModel::Decode(reader, endpoints); |
76 | 0 | } |
77 | 0 | else if (__context_tag == to_underlying(Fields::kGroupName)) |
78 | 0 | { |
79 | 0 | err = DataModel::Decode(reader, groupName); |
80 | 0 | } |
81 | 0 | else if (__context_tag == to_underlying(Fields::kFabricIndex)) |
82 | 0 | { |
83 | 0 | err = DataModel::Decode(reader, fabricIndex); |
84 | 0 | } |
85 | |
|
86 | 0 | ReturnErrorOnFailure(err); |
87 | 0 | } |
88 | 0 | } |
89 | | |
90 | | } // namespace GroupInfoMapStruct |
91 | | |
92 | | namespace GroupKeyMapStruct { |
93 | | CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
94 | 0 | { |
95 | 0 | return DoEncode(aWriter, aTag, NullOptional); |
96 | 0 | } |
97 | | |
98 | | CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const |
99 | 0 | { |
100 | 0 | return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); |
101 | 0 | } |
102 | | |
103 | | CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const |
104 | 0 | { |
105 | |
|
106 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
107 | |
|
108 | 0 | encoder.Encode(to_underlying(Fields::kGroupId), groupId); |
109 | 0 | encoder.Encode(to_underlying(Fields::kGroupKeySetID), groupKeySetID); |
110 | 0 | if (aAccessingFabricIndex.HasValue()) |
111 | 0 | { |
112 | 0 | encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); |
113 | 0 | } |
114 | |
|
115 | 0 | return encoder.Finalize(); |
116 | 0 | } |
117 | | |
118 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
119 | 0 | { |
120 | 0 | detail::StructDecodeIterator __iterator(reader); |
121 | 0 | while (true) |
122 | 0 | { |
123 | 0 | uint8_t __context_tag = 0; |
124 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
125 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
126 | 0 | ReturnErrorOnFailure(err); |
127 | | |
128 | 0 | if (__context_tag == to_underlying(Fields::kGroupId)) |
129 | 0 | { |
130 | 0 | err = DataModel::Decode(reader, groupId); |
131 | 0 | } |
132 | 0 | else if (__context_tag == to_underlying(Fields::kGroupKeySetID)) |
133 | 0 | { |
134 | 0 | err = DataModel::Decode(reader, groupKeySetID); |
135 | 0 | } |
136 | 0 | else if (__context_tag == to_underlying(Fields::kFabricIndex)) |
137 | 0 | { |
138 | 0 | err = DataModel::Decode(reader, fabricIndex); |
139 | 0 | } |
140 | |
|
141 | 0 | ReturnErrorOnFailure(err); |
142 | 0 | } |
143 | 0 | } |
144 | | |
145 | | } // namespace GroupKeyMapStruct |
146 | | |
147 | | namespace GroupKeySetStruct { |
148 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
149 | 0 | { |
150 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
151 | 0 | encoder.Encode(to_underlying(Fields::kGroupKeySetID), groupKeySetID); |
152 | 0 | encoder.Encode(to_underlying(Fields::kGroupKeySecurityPolicy), groupKeySecurityPolicy); |
153 | 0 | encoder.Encode(to_underlying(Fields::kEpochKey0), epochKey0); |
154 | 0 | encoder.Encode(to_underlying(Fields::kEpochStartTime0), epochStartTime0); |
155 | 0 | encoder.Encode(to_underlying(Fields::kEpochKey1), epochKey1); |
156 | 0 | encoder.Encode(to_underlying(Fields::kEpochStartTime1), epochStartTime1); |
157 | 0 | encoder.Encode(to_underlying(Fields::kEpochKey2), epochKey2); |
158 | 0 | encoder.Encode(to_underlying(Fields::kEpochStartTime2), epochStartTime2); |
159 | 0 | return encoder.Finalize(); |
160 | 0 | } |
161 | | |
162 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
163 | 0 | { |
164 | 0 | detail::StructDecodeIterator __iterator(reader); |
165 | 0 | while (true) |
166 | 0 | { |
167 | 0 | uint8_t __context_tag = 0; |
168 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
169 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
170 | 0 | ReturnErrorOnFailure(err); |
171 | | |
172 | 0 | if (__context_tag == to_underlying(Fields::kGroupKeySetID)) |
173 | 0 | { |
174 | 0 | err = DataModel::Decode(reader, groupKeySetID); |
175 | 0 | } |
176 | 0 | else if (__context_tag == to_underlying(Fields::kGroupKeySecurityPolicy)) |
177 | 0 | { |
178 | 0 | err = DataModel::Decode(reader, groupKeySecurityPolicy); |
179 | 0 | } |
180 | 0 | else if (__context_tag == to_underlying(Fields::kEpochKey0)) |
181 | 0 | { |
182 | 0 | err = DataModel::Decode(reader, epochKey0); |
183 | 0 | } |
184 | 0 | else if (__context_tag == to_underlying(Fields::kEpochStartTime0)) |
185 | 0 | { |
186 | 0 | err = DataModel::Decode(reader, epochStartTime0); |
187 | 0 | } |
188 | 0 | else if (__context_tag == to_underlying(Fields::kEpochKey1)) |
189 | 0 | { |
190 | 0 | err = DataModel::Decode(reader, epochKey1); |
191 | 0 | } |
192 | 0 | else if (__context_tag == to_underlying(Fields::kEpochStartTime1)) |
193 | 0 | { |
194 | 0 | err = DataModel::Decode(reader, epochStartTime1); |
195 | 0 | } |
196 | 0 | else if (__context_tag == to_underlying(Fields::kEpochKey2)) |
197 | 0 | { |
198 | 0 | err = DataModel::Decode(reader, epochKey2); |
199 | 0 | } |
200 | 0 | else if (__context_tag == to_underlying(Fields::kEpochStartTime2)) |
201 | 0 | { |
202 | 0 | err = DataModel::Decode(reader, epochStartTime2); |
203 | 0 | } |
204 | |
|
205 | 0 | ReturnErrorOnFailure(err); |
206 | 0 | } |
207 | 0 | } |
208 | | |
209 | | } // namespace GroupKeySetStruct |
210 | | } // namespace Structs |
211 | | } // namespace GroupKeyManagement |
212 | | } // namespace Clusters |
213 | | } // namespace app |
214 | | } // namespace chip |