/src/connectedhomeip/zzz_generated/app-common/clusters/Switch/Events.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-Events.ipp.zapt |
20 | | |
21 | | #include <clusters/Switch/Events.h> |
22 | | |
23 | | #include <app/data-model/Decode.h> |
24 | | #include <app/data-model/Encode.h> |
25 | | #include <app/data-model/StructDecodeIterator.h> |
26 | | #include <app/data-model/WrappedStructEncoder.h> |
27 | | |
28 | | namespace chip { |
29 | | namespace app { |
30 | | namespace Clusters { |
31 | | namespace Switch { |
32 | | namespace Events { |
33 | | namespace SwitchLatched { |
34 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
35 | 0 | { |
36 | 0 | TLV::TLVType outer; |
37 | 0 | ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); |
38 | 0 | ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewPosition), newPosition)); |
39 | 0 | return aWriter.EndContainer(outer); |
40 | 0 | } |
41 | | |
42 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
43 | 0 | { |
44 | 0 | detail::StructDecodeIterator __iterator(reader); |
45 | 0 | while (true) |
46 | 0 | { |
47 | 0 | uint8_t __context_tag = 0; |
48 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
49 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
50 | 0 | ReturnErrorOnFailure(err); |
51 | | |
52 | 0 | if (__context_tag == to_underlying(Fields::kNewPosition)) |
53 | 0 | { |
54 | 0 | err = DataModel::Decode(reader, newPosition); |
55 | 0 | } |
56 | 0 | else |
57 | 0 | { |
58 | 0 | } |
59 | |
|
60 | 0 | ReturnErrorOnFailure(err); |
61 | 0 | } |
62 | 0 | } |
63 | | } // namespace SwitchLatched. |
64 | | namespace InitialPress { |
65 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
66 | 0 | { |
67 | 0 | TLV::TLVType outer; |
68 | 0 | ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); |
69 | 0 | ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewPosition), newPosition)); |
70 | 0 | return aWriter.EndContainer(outer); |
71 | 0 | } |
72 | | |
73 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
74 | 0 | { |
75 | 0 | detail::StructDecodeIterator __iterator(reader); |
76 | 0 | while (true) |
77 | 0 | { |
78 | 0 | uint8_t __context_tag = 0; |
79 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
80 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
81 | 0 | ReturnErrorOnFailure(err); |
82 | | |
83 | 0 | if (__context_tag == to_underlying(Fields::kNewPosition)) |
84 | 0 | { |
85 | 0 | err = DataModel::Decode(reader, newPosition); |
86 | 0 | } |
87 | 0 | else |
88 | 0 | { |
89 | 0 | } |
90 | |
|
91 | 0 | ReturnErrorOnFailure(err); |
92 | 0 | } |
93 | 0 | } |
94 | | } // namespace InitialPress. |
95 | | namespace LongPress { |
96 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
97 | 0 | { |
98 | 0 | TLV::TLVType outer; |
99 | 0 | ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); |
100 | 0 | ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewPosition), newPosition)); |
101 | 0 | return aWriter.EndContainer(outer); |
102 | 0 | } |
103 | | |
104 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
105 | 0 | { |
106 | 0 | detail::StructDecodeIterator __iterator(reader); |
107 | 0 | while (true) |
108 | 0 | { |
109 | 0 | uint8_t __context_tag = 0; |
110 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
111 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
112 | 0 | ReturnErrorOnFailure(err); |
113 | | |
114 | 0 | if (__context_tag == to_underlying(Fields::kNewPosition)) |
115 | 0 | { |
116 | 0 | err = DataModel::Decode(reader, newPosition); |
117 | 0 | } |
118 | 0 | else |
119 | 0 | { |
120 | 0 | } |
121 | |
|
122 | 0 | ReturnErrorOnFailure(err); |
123 | 0 | } |
124 | 0 | } |
125 | | } // namespace LongPress. |
126 | | namespace ShortRelease { |
127 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
128 | 0 | { |
129 | 0 | TLV::TLVType outer; |
130 | 0 | ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); |
131 | 0 | ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPreviousPosition), previousPosition)); |
132 | 0 | return aWriter.EndContainer(outer); |
133 | 0 | } |
134 | | |
135 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
136 | 0 | { |
137 | 0 | detail::StructDecodeIterator __iterator(reader); |
138 | 0 | while (true) |
139 | 0 | { |
140 | 0 | uint8_t __context_tag = 0; |
141 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
142 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
143 | 0 | ReturnErrorOnFailure(err); |
144 | | |
145 | 0 | if (__context_tag == to_underlying(Fields::kPreviousPosition)) |
146 | 0 | { |
147 | 0 | err = DataModel::Decode(reader, previousPosition); |
148 | 0 | } |
149 | 0 | else |
150 | 0 | { |
151 | 0 | } |
152 | |
|
153 | 0 | ReturnErrorOnFailure(err); |
154 | 0 | } |
155 | 0 | } |
156 | | } // namespace ShortRelease. |
157 | | namespace LongRelease { |
158 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
159 | 0 | { |
160 | 0 | TLV::TLVType outer; |
161 | 0 | ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); |
162 | 0 | ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPreviousPosition), previousPosition)); |
163 | 0 | return aWriter.EndContainer(outer); |
164 | 0 | } |
165 | | |
166 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
167 | 0 | { |
168 | 0 | detail::StructDecodeIterator __iterator(reader); |
169 | 0 | while (true) |
170 | 0 | { |
171 | 0 | uint8_t __context_tag = 0; |
172 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
173 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
174 | 0 | ReturnErrorOnFailure(err); |
175 | | |
176 | 0 | if (__context_tag == to_underlying(Fields::kPreviousPosition)) |
177 | 0 | { |
178 | 0 | err = DataModel::Decode(reader, previousPosition); |
179 | 0 | } |
180 | 0 | else |
181 | 0 | { |
182 | 0 | } |
183 | |
|
184 | 0 | ReturnErrorOnFailure(err); |
185 | 0 | } |
186 | 0 | } |
187 | | } // namespace LongRelease. |
188 | | namespace MultiPressOngoing { |
189 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
190 | 0 | { |
191 | 0 | TLV::TLVType outer; |
192 | 0 | ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); |
193 | 0 | ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewPosition), newPosition)); |
194 | 0 | ReturnErrorOnFailure( |
195 | 0 | DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrentNumberOfPressesCounted), currentNumberOfPressesCounted)); |
196 | 0 | return aWriter.EndContainer(outer); |
197 | 0 | } |
198 | | |
199 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
200 | 0 | { |
201 | 0 | detail::StructDecodeIterator __iterator(reader); |
202 | 0 | while (true) |
203 | 0 | { |
204 | 0 | uint8_t __context_tag = 0; |
205 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
206 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
207 | 0 | ReturnErrorOnFailure(err); |
208 | | |
209 | 0 | if (__context_tag == to_underlying(Fields::kNewPosition)) |
210 | 0 | { |
211 | 0 | err = DataModel::Decode(reader, newPosition); |
212 | 0 | } |
213 | 0 | else if (__context_tag == to_underlying(Fields::kCurrentNumberOfPressesCounted)) |
214 | 0 | { |
215 | 0 | err = DataModel::Decode(reader, currentNumberOfPressesCounted); |
216 | 0 | } |
217 | 0 | else |
218 | 0 | { |
219 | 0 | } |
220 | |
|
221 | 0 | ReturnErrorOnFailure(err); |
222 | 0 | } |
223 | 0 | } |
224 | | } // namespace MultiPressOngoing. |
225 | | namespace MultiPressComplete { |
226 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
227 | 0 | { |
228 | 0 | TLV::TLVType outer; |
229 | 0 | ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); |
230 | 0 | ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPreviousPosition), previousPosition)); |
231 | 0 | ReturnErrorOnFailure( |
232 | 0 | DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTotalNumberOfPressesCounted), totalNumberOfPressesCounted)); |
233 | 0 | return aWriter.EndContainer(outer); |
234 | 0 | } |
235 | | |
236 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
237 | 0 | { |
238 | 0 | detail::StructDecodeIterator __iterator(reader); |
239 | 0 | while (true) |
240 | 0 | { |
241 | 0 | uint8_t __context_tag = 0; |
242 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
243 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
244 | 0 | ReturnErrorOnFailure(err); |
245 | | |
246 | 0 | if (__context_tag == to_underlying(Fields::kPreviousPosition)) |
247 | 0 | { |
248 | 0 | err = DataModel::Decode(reader, previousPosition); |
249 | 0 | } |
250 | 0 | else if (__context_tag == to_underlying(Fields::kTotalNumberOfPressesCounted)) |
251 | 0 | { |
252 | 0 | err = DataModel::Decode(reader, totalNumberOfPressesCounted); |
253 | 0 | } |
254 | 0 | else |
255 | 0 | { |
256 | 0 | } |
257 | |
|
258 | 0 | ReturnErrorOnFailure(err); |
259 | 0 | } |
260 | 0 | } |
261 | | } // namespace MultiPressComplete. |
262 | | } // namespace Events |
263 | | } // namespace Switch |
264 | | } // namespace Clusters |
265 | | } // namespace app |
266 | | } // namespace chip |