/src/connectedhomeip/zzz_generated/app-common/clusters/ScenesManagement/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/ScenesManagement/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 ScenesManagement { |
30 | | namespace Structs { |
31 | | |
32 | | namespace AttributeValuePairStruct { |
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::kAttributeID), attributeID); |
37 | 0 | encoder.Encode(to_underlying(Fields::kValueUnsigned8), valueUnsigned8); |
38 | 0 | encoder.Encode(to_underlying(Fields::kValueSigned8), valueSigned8); |
39 | 0 | encoder.Encode(to_underlying(Fields::kValueUnsigned16), valueUnsigned16); |
40 | 0 | encoder.Encode(to_underlying(Fields::kValueSigned16), valueSigned16); |
41 | 0 | encoder.Encode(to_underlying(Fields::kValueUnsigned32), valueUnsigned32); |
42 | 0 | encoder.Encode(to_underlying(Fields::kValueSigned32), valueSigned32); |
43 | 0 | encoder.Encode(to_underlying(Fields::kValueUnsigned64), valueUnsigned64); |
44 | 0 | encoder.Encode(to_underlying(Fields::kValueSigned64), valueSigned64); |
45 | 0 | return encoder.Finalize(); |
46 | 0 | } |
47 | | |
48 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
49 | 0 | { |
50 | 0 | detail::StructDecodeIterator __iterator(reader); |
51 | 0 | while (true) |
52 | 0 | { |
53 | 0 | uint8_t __context_tag = 0; |
54 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
55 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
56 | 0 | ReturnErrorOnFailure(err); |
57 | | |
58 | 0 | if (__context_tag == to_underlying(Fields::kAttributeID)) |
59 | 0 | { |
60 | 0 | err = DataModel::Decode(reader, attributeID); |
61 | 0 | } |
62 | 0 | else if (__context_tag == to_underlying(Fields::kValueUnsigned8)) |
63 | 0 | { |
64 | 0 | err = DataModel::Decode(reader, valueUnsigned8); |
65 | 0 | } |
66 | 0 | else if (__context_tag == to_underlying(Fields::kValueSigned8)) |
67 | 0 | { |
68 | 0 | err = DataModel::Decode(reader, valueSigned8); |
69 | 0 | } |
70 | 0 | else if (__context_tag == to_underlying(Fields::kValueUnsigned16)) |
71 | 0 | { |
72 | 0 | err = DataModel::Decode(reader, valueUnsigned16); |
73 | 0 | } |
74 | 0 | else if (__context_tag == to_underlying(Fields::kValueSigned16)) |
75 | 0 | { |
76 | 0 | err = DataModel::Decode(reader, valueSigned16); |
77 | 0 | } |
78 | 0 | else if (__context_tag == to_underlying(Fields::kValueUnsigned32)) |
79 | 0 | { |
80 | 0 | err = DataModel::Decode(reader, valueUnsigned32); |
81 | 0 | } |
82 | 0 | else if (__context_tag == to_underlying(Fields::kValueSigned32)) |
83 | 0 | { |
84 | 0 | err = DataModel::Decode(reader, valueSigned32); |
85 | 0 | } |
86 | 0 | else if (__context_tag == to_underlying(Fields::kValueUnsigned64)) |
87 | 0 | { |
88 | 0 | err = DataModel::Decode(reader, valueUnsigned64); |
89 | 0 | } |
90 | 0 | else if (__context_tag == to_underlying(Fields::kValueSigned64)) |
91 | 0 | { |
92 | 0 | err = DataModel::Decode(reader, valueSigned64); |
93 | 0 | } |
94 | |
|
95 | 0 | ReturnErrorOnFailure(err); |
96 | 0 | } |
97 | 0 | } |
98 | | |
99 | | } // namespace AttributeValuePairStruct |
100 | | |
101 | | namespace ExtensionFieldSetStruct { |
102 | | CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
103 | 0 | { |
104 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
105 | 0 | encoder.Encode(to_underlying(Fields::kClusterID), clusterID); |
106 | 0 | encoder.Encode(to_underlying(Fields::kAttributeValueList), attributeValueList); |
107 | 0 | return encoder.Finalize(); |
108 | 0 | } |
109 | | |
110 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
111 | 0 | { |
112 | 0 | detail::StructDecodeIterator __iterator(reader); |
113 | 0 | while (true) |
114 | 0 | { |
115 | 0 | uint8_t __context_tag = 0; |
116 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
117 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
118 | 0 | ReturnErrorOnFailure(err); |
119 | | |
120 | 0 | if (__context_tag == to_underlying(Fields::kClusterID)) |
121 | 0 | { |
122 | 0 | err = DataModel::Decode(reader, clusterID); |
123 | 0 | } |
124 | 0 | else if (__context_tag == to_underlying(Fields::kAttributeValueList)) |
125 | 0 | { |
126 | 0 | err = DataModel::Decode(reader, attributeValueList); |
127 | 0 | } |
128 | |
|
129 | 0 | ReturnErrorOnFailure(err); |
130 | 0 | } |
131 | 0 | } |
132 | | |
133 | | } // namespace ExtensionFieldSetStruct |
134 | | |
135 | | namespace SceneInfoStruct { |
136 | | CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
137 | 0 | { |
138 | 0 | return DoEncode(aWriter, aTag, NullOptional); |
139 | 0 | } |
140 | | |
141 | | CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const |
142 | 0 | { |
143 | 0 | return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); |
144 | 0 | } |
145 | | |
146 | | CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const |
147 | 0 | { |
148 | 0 | bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex); |
149 | |
|
150 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
151 | |
|
152 | 0 | encoder.Encode(to_underlying(Fields::kSceneCount), sceneCount); |
153 | 0 | if (includeSensitive) |
154 | 0 | { |
155 | 0 | encoder.Encode(to_underlying(Fields::kCurrentScene), currentScene); |
156 | 0 | } |
157 | 0 | if (includeSensitive) |
158 | 0 | { |
159 | 0 | encoder.Encode(to_underlying(Fields::kCurrentGroup), currentGroup); |
160 | 0 | } |
161 | 0 | if (includeSensitive) |
162 | 0 | { |
163 | 0 | encoder.Encode(to_underlying(Fields::kSceneValid), sceneValid); |
164 | 0 | } |
165 | 0 | encoder.Encode(to_underlying(Fields::kRemainingCapacity), remainingCapacity); |
166 | 0 | if (aAccessingFabricIndex.HasValue()) |
167 | 0 | { |
168 | 0 | encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); |
169 | 0 | } |
170 | |
|
171 | 0 | return encoder.Finalize(); |
172 | 0 | } |
173 | | |
174 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
175 | 0 | { |
176 | 0 | detail::StructDecodeIterator __iterator(reader); |
177 | 0 | while (true) |
178 | 0 | { |
179 | 0 | uint8_t __context_tag = 0; |
180 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
181 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
182 | 0 | ReturnErrorOnFailure(err); |
183 | | |
184 | 0 | if (__context_tag == to_underlying(Fields::kSceneCount)) |
185 | 0 | { |
186 | 0 | err = DataModel::Decode(reader, sceneCount); |
187 | 0 | } |
188 | 0 | else if (__context_tag == to_underlying(Fields::kCurrentScene)) |
189 | 0 | { |
190 | 0 | err = DataModel::Decode(reader, currentScene); |
191 | 0 | } |
192 | 0 | else if (__context_tag == to_underlying(Fields::kCurrentGroup)) |
193 | 0 | { |
194 | 0 | err = DataModel::Decode(reader, currentGroup); |
195 | 0 | } |
196 | 0 | else if (__context_tag == to_underlying(Fields::kSceneValid)) |
197 | 0 | { |
198 | 0 | err = DataModel::Decode(reader, sceneValid); |
199 | 0 | } |
200 | 0 | else if (__context_tag == to_underlying(Fields::kRemainingCapacity)) |
201 | 0 | { |
202 | 0 | err = DataModel::Decode(reader, remainingCapacity); |
203 | 0 | } |
204 | 0 | else if (__context_tag == to_underlying(Fields::kFabricIndex)) |
205 | 0 | { |
206 | 0 | err = DataModel::Decode(reader, fabricIndex); |
207 | 0 | } |
208 | |
|
209 | 0 | ReturnErrorOnFailure(err); |
210 | 0 | } |
211 | 0 | } |
212 | | |
213 | | } // namespace SceneInfoStruct |
214 | | } // namespace Structs |
215 | | } // namespace ScenesManagement |
216 | | } // namespace Clusters |
217 | | } // namespace app |
218 | | } // namespace chip |