|
| 1 | +/* |
| 2 | + * |
| 3 | + * Copyright (c) 2025 Project CHIP Authors |
| 4 | + * All rights reserved. |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +#pragma once |
| 20 | + |
| 21 | +#include <app-common/zap-generated/cluster-objects.h> |
| 22 | +#include <lib/support/CommonIterator.h> |
| 23 | + |
| 24 | +namespace chip { |
| 25 | +namespace app { |
| 26 | +namespace Clusters { |
| 27 | +namespace ClosureControl { |
| 28 | + |
| 29 | +/** |
| 30 | + * Structure represents the overall state of a closure control cluster derivation instance. |
| 31 | + */ |
| 32 | +struct GenericOverallState : public Structs::OverallStateStruct::Type |
| 33 | +{ |
| 34 | + GenericOverallState(Optional<PositioningEnum> positioningValue = NullOptional, |
| 35 | + Optional<LatchingEnum> latchingValue = NullOptional, |
| 36 | + Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional, |
| 37 | + Optional<uint32_t> extraInfoValue = NullOptional) |
| 38 | + { |
| 39 | + Set(positioningValue, latchingValue, speedValue, extraInfoValue); |
| 40 | + } |
| 41 | + |
| 42 | + GenericOverallState(const GenericOverallState & overallState) { *this = overallState; } |
| 43 | + |
| 44 | + GenericOverallState & operator=(const GenericOverallState & overallState) |
| 45 | + { |
| 46 | + Set(overallState.positioning, overallState.latching, overallState.speed, overallState.extraInfo); |
| 47 | + return *this; |
| 48 | + } |
| 49 | + |
| 50 | + void Set(Optional<PositioningEnum> positioningValue = NullOptional, Optional<LatchingEnum> latchingValue = NullOptional, |
| 51 | + Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional, Optional<uint32_t> extraInfoValue = NullOptional) |
| 52 | + { |
| 53 | + positioning = positioningValue; |
| 54 | + latching = latchingValue; |
| 55 | + speed = speedValue; |
| 56 | + extraInfo = extraInfoValue; |
| 57 | + } |
| 58 | + |
| 59 | + bool operator==(const Structs::OverallStateStruct::Type & rhs) const |
| 60 | + { |
| 61 | + return positioning == rhs.positioning && latching == rhs.latching && speed == rhs.speed && extraInfo == rhs.extraInfo; |
| 62 | + } |
| 63 | +}; |
| 64 | + |
| 65 | +/** |
| 66 | + * Structure represents the overall target state of a closure control cluster derivation instance. |
| 67 | + */ |
| 68 | +struct GenericOverallTarget : public Structs::OverallTargetStruct::Type |
| 69 | +{ |
| 70 | + GenericOverallTarget(Optional<TagPositionEnum> tagPositionValue = NullOptional, |
| 71 | + Optional<TagLatchEnum> tagLatchValue = NullOptional, |
| 72 | + Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional) |
| 73 | + { |
| 74 | + Set(tagPositionValue, tagLatchValue, speedValue); |
| 75 | + } |
| 76 | + |
| 77 | + GenericOverallTarget(const GenericOverallTarget & overallTarget) { *this = overallTarget; } |
| 78 | + |
| 79 | + GenericOverallTarget & operator=(const GenericOverallTarget & overallTarget) |
| 80 | + { |
| 81 | + Set(overallTarget.tagPosition, overallTarget.tagLatch, overallTarget.speed); |
| 82 | + return *this; |
| 83 | + } |
| 84 | + |
| 85 | + void Set(Optional<TagPositionEnum> tagPositionValue = NullOptional, Optional<TagLatchEnum> tagLatchValue = NullOptional, |
| 86 | + Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional) |
| 87 | + { |
| 88 | + tagPosition = tagPositionValue; |
| 89 | + tagLatch = tagLatchValue; |
| 90 | + speed = speedValue; |
| 91 | + } |
| 92 | + |
| 93 | + bool operator==(const Structs::OverallTargetStruct::Type & rhs) const |
| 94 | + { |
| 95 | + return tagPosition == rhs.tagPosition && tagLatch == rhs.tagLatch && speed == rhs.speed; |
| 96 | + } |
| 97 | +}; |
| 98 | + |
| 99 | +} // namespace ClosureControl |
| 100 | +} // namespace Clusters |
| 101 | +} // namespace app |
| 102 | +} // namespace chip |
0 commit comments