blob: a7683512219ea500171504e6e6734660a32c5fad [file] [log] [blame]
/*
*
* Copyright (c) 2022 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// THIS FILE IS GENERATED BY ZAP
// This file is generated from clusters-Structs.ipp.zapt
#include <clusters/ContentLauncher/Structs.h>
#include <app/data-model/StructDecodeIterator.h>
#include <app/data-model/WrappedStructEncoder.h>
namespace chip {
namespace app {
namespace Clusters {
namespace ContentLauncher {
namespace Structs {
namespace DimensionStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
encoder.Encode(to_underlying(Fields::kWidth), width);
encoder.Encode(to_underlying(Fields::kHeight), height);
encoder.Encode(to_underlying(Fields::kMetric), metric);
return encoder.Finalize();
}
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
detail::StructDecodeIterator __iterator(reader);
while (true)
{
uint8_t __context_tag = 0;
CHIP_ERROR err = __iterator.Next(__context_tag);
VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);
if (__context_tag == to_underlying(Fields::kWidth))
{
err = DataModel::Decode(reader, width);
}
else if (__context_tag == to_underlying(Fields::kHeight))
{
err = DataModel::Decode(reader, height);
}
else if (__context_tag == to_underlying(Fields::kMetric))
{
err = DataModel::Decode(reader, metric);
}
ReturnErrorOnFailure(err);
}
}
} // namespace DimensionStruct
namespace TrackPreferenceStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
encoder.Encode(to_underlying(Fields::kLanguageCode), languageCode);
encoder.Encode(to_underlying(Fields::kCharacteristics), characteristics);
encoder.Encode(to_underlying(Fields::kAudioOutputIndex), audioOutputIndex);
return encoder.Finalize();
}
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
detail::StructDecodeIterator __iterator(reader);
while (true)
{
uint8_t __context_tag = 0;
CHIP_ERROR err = __iterator.Next(__context_tag);
VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);
if (__context_tag == to_underlying(Fields::kLanguageCode))
{
err = DataModel::Decode(reader, languageCode);
}
else if (__context_tag == to_underlying(Fields::kCharacteristics))
{
err = DataModel::Decode(reader, characteristics);
}
else if (__context_tag == to_underlying(Fields::kAudioOutputIndex))
{
err = DataModel::Decode(reader, audioOutputIndex);
}
ReturnErrorOnFailure(err);
}
}
} // namespace TrackPreferenceStruct
namespace PlaybackPreferencesStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
encoder.Encode(to_underlying(Fields::kPlaybackPosition), playbackPosition);
encoder.Encode(to_underlying(Fields::kTextTrack), textTrack);
encoder.Encode(to_underlying(Fields::kAudioTracks), audioTracks);
return encoder.Finalize();
}
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
detail::StructDecodeIterator __iterator(reader);
while (true)
{
uint8_t __context_tag = 0;
CHIP_ERROR err = __iterator.Next(__context_tag);
VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);
if (__context_tag == to_underlying(Fields::kPlaybackPosition))
{
err = DataModel::Decode(reader, playbackPosition);
}
else if (__context_tag == to_underlying(Fields::kTextTrack))
{
err = DataModel::Decode(reader, textTrack);
}
else if (__context_tag == to_underlying(Fields::kAudioTracks))
{
err = DataModel::Decode(reader, audioTracks);
}
ReturnErrorOnFailure(err);
}
}
} // namespace PlaybackPreferencesStruct
namespace AdditionalInfoStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
encoder.Encode(to_underlying(Fields::kName), name);
encoder.Encode(to_underlying(Fields::kValue), value);
return encoder.Finalize();
}
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
detail::StructDecodeIterator __iterator(reader);
while (true)
{
uint8_t __context_tag = 0;
CHIP_ERROR err = __iterator.Next(__context_tag);
VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);
if (__context_tag == to_underlying(Fields::kName))
{
err = DataModel::Decode(reader, name);
}
else if (__context_tag == to_underlying(Fields::kValue))
{
err = DataModel::Decode(reader, value);
}
ReturnErrorOnFailure(err);
}
}
} // namespace AdditionalInfoStruct
namespace ParameterStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
encoder.Encode(to_underlying(Fields::kType), type);
encoder.Encode(to_underlying(Fields::kValue), value);
encoder.Encode(to_underlying(Fields::kExternalIDList), externalIDList);
return encoder.Finalize();
}
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
detail::StructDecodeIterator __iterator(reader);
while (true)
{
uint8_t __context_tag = 0;
CHIP_ERROR err = __iterator.Next(__context_tag);
VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);
if (__context_tag == to_underlying(Fields::kType))
{
err = DataModel::Decode(reader, type);
}
else if (__context_tag == to_underlying(Fields::kValue))
{
err = DataModel::Decode(reader, value);
}
else if (__context_tag == to_underlying(Fields::kExternalIDList))
{
err = DataModel::Decode(reader, externalIDList);
}
ReturnErrorOnFailure(err);
}
}
} // namespace ParameterStruct
namespace ContentSearchStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
encoder.Encode(to_underlying(Fields::kParameterList), parameterList);
return encoder.Finalize();
}
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
detail::StructDecodeIterator __iterator(reader);
while (true)
{
uint8_t __context_tag = 0;
CHIP_ERROR err = __iterator.Next(__context_tag);
VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);
if (__context_tag == to_underlying(Fields::kParameterList))
{
err = DataModel::Decode(reader, parameterList);
}
ReturnErrorOnFailure(err);
}
}
} // namespace ContentSearchStruct
namespace StyleInformationStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
encoder.Encode(to_underlying(Fields::kImageURL), imageURL);
encoder.Encode(to_underlying(Fields::kColor), color);
encoder.Encode(to_underlying(Fields::kSize), size);
return encoder.Finalize();
}
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
detail::StructDecodeIterator __iterator(reader);
while (true)
{
uint8_t __context_tag = 0;
CHIP_ERROR err = __iterator.Next(__context_tag);
VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);
if (__context_tag == to_underlying(Fields::kImageURL))
{
err = DataModel::Decode(reader, imageURL);
}
else if (__context_tag == to_underlying(Fields::kColor))
{
err = DataModel::Decode(reader, color);
}
else if (__context_tag == to_underlying(Fields::kSize))
{
err = DataModel::Decode(reader, size);
}
ReturnErrorOnFailure(err);
}
}
} // namespace StyleInformationStruct
namespace BrandingInformationStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
encoder.Encode(to_underlying(Fields::kProviderName), providerName);
encoder.Encode(to_underlying(Fields::kBackground), background);
encoder.Encode(to_underlying(Fields::kLogo), logo);
encoder.Encode(to_underlying(Fields::kProgressBar), progressBar);
encoder.Encode(to_underlying(Fields::kSplash), splash);
encoder.Encode(to_underlying(Fields::kWaterMark), waterMark);
return encoder.Finalize();
}
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
detail::StructDecodeIterator __iterator(reader);
while (true)
{
uint8_t __context_tag = 0;
CHIP_ERROR err = __iterator.Next(__context_tag);
VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);
if (__context_tag == to_underlying(Fields::kProviderName))
{
err = DataModel::Decode(reader, providerName);
}
else if (__context_tag == to_underlying(Fields::kBackground))
{
err = DataModel::Decode(reader, background);
}
else if (__context_tag == to_underlying(Fields::kLogo))
{
err = DataModel::Decode(reader, logo);
}
else if (__context_tag == to_underlying(Fields::kProgressBar))
{
err = DataModel::Decode(reader, progressBar);
}
else if (__context_tag == to_underlying(Fields::kSplash))
{
err = DataModel::Decode(reader, splash);
}
else if (__context_tag == to_underlying(Fields::kWaterMark))
{
err = DataModel::Decode(reader, waterMark);
}
ReturnErrorOnFailure(err);
}
}
} // namespace BrandingInformationStruct
} // namespace Structs
} // namespace ContentLauncher
} // namespace Clusters
} // namespace app
} // namespace chip