/** * * Copyright (c) 2024 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. */ /**************************************************************************** * @file * @brief This class has a struct PresetStructWithOwnedMembers that inherits from * Structs::PresetStruct::Type and manages the storage of the preset handle * member which it owns. * ******************************************************************************* ******************************************************************************/ #pragma once #include namespace chip { namespace app { namespace Clusters { namespace Thermostat { static constexpr size_t kPresetHandleSize = 16; static constexpr size_t kPresetNameSize = 64; struct PresetStructWithOwnedMembers : protected Structs::PresetStruct::Type { public: PresetStructWithOwnedMembers() = default; PresetStructWithOwnedMembers(const Structs::PresetStruct::Type & other); PresetStructWithOwnedMembers & operator=(const Structs::PresetStruct::Type & other); PresetStructWithOwnedMembers & operator=(const PresetStructWithOwnedMembers & other); void SetPresetScenario(PresetScenarioEnum enumValue); CHIP_ERROR SetPresetHandle(const DataModel::Nullable & newPresetHandle); CHIP_ERROR SetName(const Optional> & newName); void SetCoolingSetpoint(const Optional & newCoolingSetpoint); void SetHeatingSetpoint(const Optional & newHeatingSetpoint); void SetBuiltIn(DataModel::Nullable newBuiltIn); PresetScenarioEnum GetPresetScenario() const; DataModel::Nullable GetPresetHandle() const; Optional> GetName() const; Optional GetCoolingSetpoint() const; Optional GetHeatingSetpoint() const; DataModel::Nullable GetBuiltIn() const; using Structs::PresetStruct::Type::Encode; using Structs::PresetStruct::Type::kIsFabricScoped; private: uint8_t presetHandleData[kPresetHandleSize] = { 0 }; char presetNameData[kPresetNameSize]; }; } // namespace Thermostat } // namespace Clusters } // namespace app } // namespace chip