Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure control cluster server code implementation #37561

Merged
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
acc7a7d
Closure control sluster Server Code
satyanaag-silabs Feb 13, 2025
651fb3b
Merge branch 'project-chip:master' into feature/closure_control_serve…
sabollim-silabs Feb 14, 2025
83d5671
Merge branch 'project-chip:master' into feature/closure_control_serve…
sabollim-silabs Feb 17, 2025
88785ee
Restyled by whitespace
restyled-commits Feb 17, 2025
236a68b
Restyled by clang-format
restyled-commits Feb 17, 2025
280df4f
Changing MainState and Countdowntime Implementation
satyanaag-silabs Feb 17, 2025
2e82a85
Handling OverallState and OverallTarget from Instance
satyanaag-silabs Feb 18, 2025
1e81e1d
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 18, 2025
c230a1d
Addressing PR comments
satyanaag-silabs Feb 18, 2025
bccbebe
Restyled by whitespace
restyled-commits Feb 18, 2025
5c130df
Restyled by clang-format
restyled-commits Feb 18, 2025
3ee28a1
Updating missing zap changes
satyanaag-silabs Feb 19, 2025
266ea21
Adding wrapper for struct handling
satyanaag-silabs Feb 19, 2025
b03460e
Restyled by whitespace
restyled-commits Feb 19, 2025
1ad934c
Restyled by clang-format
restyled-commits Feb 19, 2025
e07b850
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 19, 2025
757a2c7
Addressing PR comments
satyanaag-silabs Feb 20, 2025
c437637
Merge branch 'feature/closure_control_server_code' of https://github.…
satyanaag-silabs Feb 20, 2025
18f6829
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 20, 2025
45d3294
Addressing PR comments
satyanaag-silabs Feb 20, 2025
ada6747
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 20, 2025
ed605a7
Restyled by clang-format
restyled-commits Feb 20, 2025
d7b51e7
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 21, 2025
0486d1f
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 24, 2025
968ba9f
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 24, 2025
75559d9
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 24, 2025
2963bab
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 25, 2025
ac42399
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 25, 2025
bd5a0a5
addressing PR comments
satyanaag-silabs Feb 25, 2025
afae064
changing IsEqual to operator==
satyanaag-silabs Feb 26, 2025
270be8e
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 26, 2025
0e4a00d
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 27, 2025
cece03e
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 27, 2025
ba8d87c
Addressing PR comments
satyanaag-silabs Feb 27, 2025
408c94d
Addresssing PR comments
satyanaag-silabs Feb 27, 2025
b4f685e
Removing Fallback feature attribute and commands as FB feature is rem…
satyanaag-silabs Feb 27, 2025
5f8858c
Addressing PR comments
satyanaag-silabs Feb 27, 2025
c282599
Updating countdonwtime quiet reporting policy
satyanaag-silabs Feb 27, 2025
f5f9fed
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 27, 2025
acb1c5b
Restyled by whitespace
restyled-commits Feb 27, 2025
a1766e6
Restyled by clang-format
restyled-commits Feb 27, 2025
4ab2e09
Merge branch 'master' into feature/closure_control_server_code
sabollim-silabs Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ template("chip_data_model") {
"${_app_root}/clusters/${cluster}/ArlEncoder.cpp",
"${_app_root}/clusters/${cluster}/ArlEncoder.h",
]
} else if (cluster == "closure-control-server") {
sources += [
"${_app_root}/clusters/${cluster}/${cluster}.cpp",
"${_app_root}/clusters/${cluster}/${cluster}.h",
"${_app_root}/clusters/${cluster}/closure-control-cluster-objects.h",
]
} else {
sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
*
* Copyright (c) 2025 Project CHIP Authors
* All rights reserved.
*
* 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.
*/

#pragma once

#include <app-common/zap-generated/cluster-objects.h>
#include <lib/support/CommonIterator.h>

namespace chip {
namespace app {
namespace Clusters {
namespace ClosureControl {

/**
* Structure represents the overall state of a closure control cluster derivation instance.
*/
struct GenericOverallState : public Structs::OverallStateStruct::Type
{
GenericOverallState(Optional<PositioningEnum> positioningValue = NullOptional,
Optional<LatchingEnum> latchingValue = NullOptional,
Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional,
Optional<uint32_t> extraInfoValue = NullOptional)
{
Set(positioningValue, latchingValue, speedValue, extraInfoValue);
}

GenericOverallState(const GenericOverallState & overallState) { *this = overallState; }

GenericOverallState & operator=(const GenericOverallState & overallState)
{
Set(overallState.positioning, overallState.latching, overallState.speed, overallState.extraInfo);
return *this;
}

void Set(Optional<PositioningEnum> positioningValue = NullOptional, Optional<LatchingEnum> latchingValue = NullOptional,
Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional, Optional<uint32_t> extraInfoValue = NullOptional)
{
if (positioningValue.HasValue())
{
positioning = positioningValue;
}
if (latchingValue.HasValue())
{
latching = latchingValue;
}
if (speedValue.HasValue())
{
speed = speedValue;
}
if (extraInfoValue.HasValue())
{
extraInfo = extraInfoValue;
}
}

bool IsEqual(const Structs::OverallStateStruct::Type & rhs) const
{
if (positioning.HasValue() != rhs.positioning.HasValue() || latching.HasValue() != rhs.latching.HasValue() ||
speed.HasValue() != rhs.speed.HasValue() || extraInfo.HasValue() != rhs.extraInfo.HasValue())
{
return false;
}

if (positioning.HasValue() && positioning.Value() != rhs.positioning.Value())
{
return false;
}
if (latching.HasValue() && latching.Value() != rhs.latching.Value())
{
return false;
}
if (speed.HasValue() && speed.Value() != rhs.speed.Value())
{
return false;
}
if (extraInfo.HasValue() && extraInfo.Value() != rhs.extraInfo.Value())
{
return false;
}

return true;
}
};

/**
* Structure represents the overall target state of a closure control cluster derivation instance.
*/
struct GenericOverallTarget : public Structs::OverallTargetStruct::Type
{
GenericOverallTarget(Optional<TagPositionEnum> tagPositionValue = NullOptional,
Optional<TagLatchEnum> tagLatchValue = NullOptional,
Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional)
{
Set(tagPositionValue, tagLatchValue, speedValue);
}

GenericOverallTarget(const GenericOverallTarget & overallTarget) { *this = overallTarget; }

GenericOverallTarget & operator=(const GenericOverallTarget & overallTarget)
{
Set(overallTarget.tagPosition, overallTarget.tagLatch, overallTarget.speed);
return *this;
}

void Set(Optional<TagPositionEnum> tagPositionValue = NullOptional, Optional<TagLatchEnum> tagLatchValue = NullOptional,
Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional)
{
if (tagPositionValue.HasValue())
{
tagPosition = tagPositionValue;
}
if (tagLatchValue.HasValue())
{
tagLatch = tagLatchValue;
}
if (speedValue.HasValue())
{
speed = speedValue;
}
}

bool IsEqual(const Structs::OverallTargetStruct::Type & rhs) const
{
if (tagPosition.HasValue() != rhs.tagPosition.HasValue() || tagLatch.HasValue() != rhs.tagLatch.HasValue() ||
speed.HasValue() != rhs.speed.HasValue())
{
return false;
}

if (tagPosition.HasValue() && tagPosition.Value() != rhs.tagPosition.Value())
{
return false;
}
if (tagLatch.HasValue() && tagLatch.Value() != rhs.tagLatch.Value())
{
return false;
}
if (speed.HasValue() && speed.Value() != rhs.speed.Value())
{
return false;
}

return true;
}
};

} // namespace ClosureControl
} // namespace Clusters
} // namespace app
} // namespace chip
Loading
Loading