Skip to content

Commit ddc8d0e

Browse files
sabollim-silabsrestyled-commitsmkardous-silabs
authored
[Closure] Closure dimension spec final changes (project-chip#38516)
* Closure dimension spec final changes * Restyled by whitespace * Restyled by clang-format * Remove unwante debug print * Removing Unwanted includes * Addressing PR commnets * Fix Build issues * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Fixing issue found during Enhancing UT * Restyled by whitespace * Restyled by clang-format * Update src/app/clusters/closure-dimension-server/closure-dimension-cluster-logic.cpp Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Update src/app/clusters/closure-dimension-server/closure-dimension-cluster-logic.h Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Update src/app/tests/TestClosureDimensionCluster.cpp Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Update src/app/clusters/closure-dimension-server/closure-dimension-cluster-logic.h Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Addressing PR comments * Restyled by whitespace * Restyled by clang-format * Apply suggestions from code review Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Addressing PR comments * Restyled by whitespace * Restyled by clang-format * Replacing term device with closure * Fix CI build Failure due to unused variable in Tests * Addressing PR comments * Restyled by whitespace * Restyled by clang-format * Apply suggestions from code review Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com> * Addressing PR comments * Restyled by whitespace * Restyled by clang-format * Addressing PR comments * Restyled by clang-format --------- Co-authored-by: sabollim <satyanaag.bollimpalli@silabs.com> Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Mathieu Kardous <84793247+mkardous-silabs@users.noreply.github.com>
1 parent c3b6b76 commit ddc8d0e

8 files changed

Lines changed: 2625 additions & 214 deletions

src/app/clusters/closure-dimension-server/closure-dimension-cluster-logic.cpp

Lines changed: 233 additions & 133 deletions
Large diffs are not rendered by default.

src/app/clusters/closure-dimension-server/closure-dimension-cluster-logic.h

Lines changed: 187 additions & 74 deletions
Large diffs are not rendered by default.

src/app/clusters/closure-dimension-server/closure-dimension-cluster-objects.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ struct GenericCurrentStateStruct : public Structs::CurrentStateStruct::Type
4444
return *this;
4545
}
4646

47-
void Set(Optional<Percent100ths> positioningValue = NullOptional, Optional<bool> latchValue = NullOptional,
47+
void Set(Optional<Percent100ths> positionValue = NullOptional, Optional<bool> latchValue = NullOptional,
4848
Optional<Globals::ThreeLevelAutoEnum> speedValue = NullOptional)
4949
{
50-
position = positioningValue;
50+
position = positionValue;
5151
latch = latchValue;
5252
speed = speedValue;
5353
}

src/app/clusters/closure-dimension-server/closure-dimension-delegate.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ class DelegateBase
6363
*/
6464
virtual Protocols::InteractionModel::Status HandleStep(const StepDirectionEnum & direction, const uint16_t & numberOfSteps,
6565
const Optional<Globals::ThreeLevelAutoEnum> & speed) = 0;
66+
67+
/**
68+
* @brief Checks whether this closurepanel needs manual latching.
69+
*
70+
* @return true if manual latching is needed
71+
* false if manual latching not needed
72+
*/
73+
virtual bool IsManualLatchingNeeded() = 0;
6674
};
6775

6876
} // namespace ClosureDimension

src/app/clusters/closure-dimension-server/closure-dimension-server.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,11 @@ CHIP_ERROR Interface::Read(const ConcreteReadAttributePath & aPath, AttributeVal
4444
switch (aPath.mAttributeId)
4545
{
4646
case Attributes::CurrentState::Id: {
47-
typedef GenericCurrentStateStruct T;
47+
typedef DataModel::Nullable<GenericCurrentStateStruct> T;
4848
return EncodeRead<T>(aEncoder, [&logic = mClusterLogic](T & ret) -> CHIP_ERROR { return logic.GetCurrentState(ret); });
4949
}
5050
case Attributes::Target::Id: {
51-
// TODO: Each field SHALL be available following its respective feature. If the feature is not set the field SHALL NOT be
52-
// present.
53-
typedef GenericTargetStruct T;
51+
typedef DataModel::Nullable<GenericTargetStruct> T;
5452
return EncodeRead<T>(aEncoder, [&logic = mClusterLogic](T & ret) -> CHIP_ERROR { return logic.GetTarget(ret); });
5553
}
5654
case Attributes::Resolution::Id: {
@@ -91,7 +89,7 @@ CHIP_ERROR Interface::Read(const ConcreteReadAttributePath & aPath, AttributeVal
9189
return EncodeRead<T>(aEncoder, [&logic = mClusterLogic](T & ret) -> CHIP_ERROR { return logic.GetModulationType(ret); });
9290
}
9391
case Attributes::FeatureMap::Id: {
94-
typedef Attributes::FeatureMap::TypeInfo::Type T;
92+
typedef BitFlags<Feature> T;
9593
return EncodeRead<T>(aEncoder, [&logic = mClusterLogic](T & ret) -> CHIP_ERROR { return logic.GetFeatureMap(ret); });
9694
}
9795
case Attributes::ClusterRevision::Id: {

src/app/tests/BUILD.gn

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,26 @@ source_set("ecosystem-information-test-srcs") {
178178
]
179179
}
180180

181+
source_set("closure-dimension-test-srcs") {
182+
sources = [
183+
"${chip_root}/src/app/clusters/closure-dimension-server/closure-dimension-cluster-logic.cpp",
184+
"${chip_root}/src/app/clusters/closure-dimension-server/closure-dimension-cluster-logic.h",
185+
"${chip_root}/src/app/clusters/closure-dimension-server/closure-dimension-cluster-objects.h",
186+
"${chip_root}/src/app/clusters/closure-dimension-server/closure-dimension-delegate.h",
187+
"${chip_root}/src/app/clusters/closure-dimension-server/closure-dimension-matter-context.cpp",
188+
"${chip_root}/src/app/clusters/closure-dimension-server/closure-dimension-matter-context.h",
189+
"${chip_root}/src/app/clusters/closure-dimension-server/closure-dimension-server.cpp",
190+
"${chip_root}/src/app/clusters/closure-dimension-server/closure-dimension-server.h",
191+
]
192+
public_deps = [
193+
"${chip_root}/src/app:interaction-model",
194+
"${chip_root}/src/app/common:cluster-objects",
195+
"${chip_root}/src/lib/core",
196+
"${chip_root}/src/lib/support",
197+
"${chip_root}/src/platform",
198+
]
199+
}
200+
181201
source_set("app-test-stubs") {
182202
sources = [
183203
"test-ember-api.cpp",
@@ -235,6 +255,8 @@ chip_test_suite("tests") {
235255
"TestCheckInHandler.cpp",
236256
"TestClosureControlClusterLogic.cpp",
237257
"TestClosureControlConformance.cpp",
258+
"TestClosureDimensionCluster.cpp",
259+
"TestClosureDimensionClusterObjects.cpp",
238260
"TestCommandHandlerInterfaceRegistry.cpp",
239261
"TestCommandInteraction.cpp",
240262
"TestCommandPathParams.cpp",
@@ -274,6 +296,7 @@ chip_test_suite("tests") {
274296
":app-test-stubs",
275297
":binding-test-srcs",
276298
":closure-control-test-srcs",
299+
":closure-dimension-test-srcs",
277300
":ecosystem-information-test-srcs",
278301
":operational-state-test-srcs",
279302
":ota-requestor-test-srcs",

0 commit comments

Comments
 (0)