Skip to content

Commit 6012965

Browse files
jmeg-sfyrestyled-commits
authored andcommitted
WindowCovering: GoTos command field optional (#17923)
* DEV: Update xml definition for WindowCovering * DEV: Update Window-covering GoTos Method * Restyled by clang-format * XML+ZAP: Change config for GoTos to only Percenth100s * DEV: Update GoTos to handle only percent100ths param * Restyled by clang-format * ZAP: Update + Regen Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 7b4a7ff commit 6012965

File tree

21 files changed

+68
-212
lines changed

21 files changed

+68
-212
lines changed

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

+2-4
Original file line numberDiff line numberDiff line change
@@ -3736,17 +3736,15 @@ server cluster WindowCovering = 258 {
37363736
}
37373737

37383738
request struct GoToLiftPercentageRequest {
3739-
Percent liftPercentageValue = 0;
3740-
optional Percent100ths liftPercent100thsValue = 1;
3739+
Percent100ths liftPercent100thsValue = 0;
37413740
}
37423741

37433742
request struct GoToTiltValueRequest {
37443743
INT16U tiltValue = 0;
37453744
}
37463745

37473746
request struct GoToTiltPercentageRequest {
3748-
Percent tiltPercentageValue = 0;
3749-
optional Percent100ths tiltPercent100thsValue = 1;
3747+
Percent100ths tiltPercent100thsValue = 0;
37503748
}
37513749

37523750
command UpOrOpen(): DefaultSuccess = 0;

examples/placeholder/linux/apps/app1/config.matter

+2-4
Original file line numberDiff line numberDiff line change
@@ -2502,17 +2502,15 @@ server cluster WindowCovering = 258 {
25022502
}
25032503

25042504
request struct GoToLiftPercentageRequest {
2505-
Percent liftPercentageValue = 0;
2506-
optional Percent100ths liftPercent100thsValue = 1;
2505+
Percent100ths liftPercent100thsValue = 0;
25072506
}
25082507

25092508
request struct GoToTiltValueRequest {
25102509
INT16U tiltValue = 0;
25112510
}
25122511

25132512
request struct GoToTiltPercentageRequest {
2514-
Percent tiltPercentageValue = 0;
2515-
optional Percent100ths tiltPercent100thsValue = 1;
2513+
Percent100ths tiltPercent100thsValue = 0;
25162514
}
25172515

25182516
command UpOrOpen(): DefaultSuccess = 0;

examples/placeholder/linux/apps/app2/config.matter

+2-4
Original file line numberDiff line numberDiff line change
@@ -2502,17 +2502,15 @@ server cluster WindowCovering = 258 {
25022502
}
25032503

25042504
request struct GoToLiftPercentageRequest {
2505-
Percent liftPercentageValue = 0;
2506-
optional Percent100ths liftPercent100thsValue = 1;
2505+
Percent100ths liftPercent100thsValue = 0;
25072506
}
25082507

25092508
request struct GoToTiltValueRequest {
25102509
INT16U tiltValue = 0;
25112510
}
25122511

25132512
request struct GoToTiltPercentageRequest {
2514-
Percent tiltPercentageValue = 0;
2515-
optional Percent100ths tiltPercent100thsValue = 1;
2513+
Percent100ths tiltPercent100thsValue = 0;
25162514
}
25172515

25182516
command UpOrOpen(): DefaultSuccess = 0;

examples/window-app/common/window-app.matter

+2-4
Original file line numberDiff line numberDiff line change
@@ -1509,17 +1509,15 @@ server cluster WindowCovering = 258 {
15091509
}
15101510

15111511
request struct GoToLiftPercentageRequest {
1512-
Percent liftPercentageValue = 0;
1513-
optional Percent100ths liftPercent100thsValue = 1;
1512+
Percent100ths liftPercent100thsValue = 0;
15141513
}
15151514

15161515
request struct GoToTiltValueRequest {
15171516
INT16U tiltValue = 0;
15181517
}
15191518

15201519
request struct GoToTiltPercentageRequest {
1521-
Percent tiltPercentageValue = 0;
1522-
optional Percent100ths tiltPercent100thsValue = 1;
1520+
Percent100ths tiltPercent100thsValue = 0;
15231521
}
15241522

15251523
command UpOrOpen(): DefaultSuccess = 0;

src/app/clusters/window-covering-server/window-covering-server.cpp

+10-18
Original file line numberDiff line numberDiff line change
@@ -844,14 +844,10 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler
844844
const app::ConcreteCommandPath & commandPath,
845845
const Commands::GoToLiftPercentage::DecodableType & commandData)
846846
{
847-
auto & liftPercentageValue = commandData.liftPercentageValue;
848-
auto & liftPercent100thsValue = commandData.liftPercent100thsValue;
849-
Percent100ths liftPercent100ths =
850-
liftPercent100thsValue.ValueOr(static_cast<Percent100ths>(liftPercentageValue * WC_PERCENT100THS_COEF));
847+
Percent100ths percent100ths = commandData.liftPercent100thsValue;
848+
EndpointId endpoint = commandPath.mEndpointId;
851849

852-
EndpointId endpoint = commandPath.mEndpointId;
853-
854-
emberAfWindowCoveringClusterPrint("GoToLiftPercentage %u%% %u command received", liftPercentageValue, liftPercent100ths);
850+
emberAfWindowCoveringClusterPrint("GoToLiftPercentage %u command received", percent100ths);
855851

856852
EmberAfStatus status = GetMotionLockStatus(endpoint);
857853
if (EMBER_ZCL_STATUS_SUCCESS != status)
@@ -863,9 +859,9 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler
863859

864860
if (HasFeaturePaLift(endpoint))
865861
{
866-
if (IsPercent100thsValid(liftPercent100ths))
862+
if (IsPercent100thsValid(percent100ths))
867863
{
868-
Attributes::TargetPositionLiftPercent100ths::Set(endpoint, liftPercent100ths);
864+
Attributes::TargetPositionLiftPercent100ths::Set(endpoint, percent100ths);
869865
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
870866
}
871867
else
@@ -922,14 +918,10 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler
922918
const app::ConcreteCommandPath & commandPath,
923919
const Commands::GoToTiltPercentage::DecodableType & commandData)
924920
{
925-
auto & tiltPercentageValue = commandData.tiltPercentageValue;
926-
auto & tiltPercent100thsValue = commandData.tiltPercent100thsValue;
927-
Percent100ths tiltPercent100ths =
928-
tiltPercent100thsValue.ValueOr(static_cast<Percent100ths>(tiltPercentageValue * WC_PERCENT100THS_COEF));
929-
930-
EndpointId endpoint = commandPath.mEndpointId;
921+
Percent100ths percent100ths = commandData.tiltPercent100thsValue;
922+
EndpointId endpoint = commandPath.mEndpointId;
931923

932-
emberAfWindowCoveringClusterPrint("GoToTiltPercentage %u%% %u command received", tiltPercentageValue, tiltPercent100ths);
924+
emberAfWindowCoveringClusterPrint("GoToTiltPercentage %u command received", percent100ths);
933925

934926
EmberAfStatus status = GetMotionLockStatus(endpoint);
935927
if (EMBER_ZCL_STATUS_SUCCESS != status)
@@ -941,9 +933,9 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler
941933

942934
if (HasFeaturePaTilt(endpoint))
943935
{
944-
if (IsPercent100thsValid(tiltPercent100ths))
936+
if (IsPercent100thsValid(percent100ths))
945937
{
946-
Attributes::TargetPositionTiltPercent100ths::Set(endpoint, tiltPercent100ths);
938+
Attributes::TargetPositionTiltPercent100ths::Set(endpoint, percent100ths);
947939
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
948940
}
949941
else

src/app/clusters/window-covering-server/window-covering-server.h

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ typedef DataModel::Nullable<Percent> NPercent;
3838
typedef DataModel::Nullable<Percent100ths> NPercent100ths;
3939
typedef DataModel::Nullable<uint16_t> NAbsolute;
4040

41+
typedef Optional<Percent> OPercent;
42+
typedef Optional<Percent100ths> OPercent100ths;
4143
// Match directly with OperationalStatus 2 bits Fields
4244
enum class OperationalState : uint8_t
4345
{

src/app/zap-templates/zcl/data-model/chip/window-covering.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ limitations under the License.
109109
<!-- Conformance feature LF & PA_LF | [LF] - for now optional -->
110110
<command source="client" code="0x05" name="GoToLiftPercentage" optional="true" cli="zcl WindowCovering GoToLiftPercentage">
111111
<description>Go to lift percentage specified</description>
112-
<arg name="liftPercentageValue" type="Percent"/>
113-
<arg name="liftPercent100thsValue" type="Percent100ths" optional="true"/>
112+
<arg name="liftPercent100thsValue" type="Percent100ths"/>
114113
</command>
115114
<!-- Conformance feature [TL & ABS] - for now optional -->
116115
<command source="client" code="0x07" name="GoToTiltValue" optional="true" cli="zcl WindowCovering GoToTiltValue">
@@ -120,8 +119,7 @@ limitations under the License.
120119
<!-- Conformance feature TL & PA_TL | [TL] - for now optional -->
121120
<command source="client" code="0x08" name="GoToTiltPercentage" optional="true" cli="zcl WindowCovering GoToTiltPercentage">
122121
<description>Go to tilt percentage specified</description>
123-
<arg name="tiltPercentageValue" type="Percent"/>
124-
<arg name="tiltPercent100thsValue" type="Percent100ths" optional="true"/>
122+
<arg name="tiltPercent100thsValue" type="Percent100ths"/>
125123
</command>
126124
</cluster>
127125

src/controller/data_model/controller-clusters.matter

+2-4
Original file line numberDiff line numberDiff line change
@@ -4270,17 +4270,15 @@ client cluster WindowCovering = 258 {
42704270
}
42714271

42724272
request struct GoToLiftPercentageRequest {
4273-
Percent liftPercentageValue = 0;
4274-
optional Percent100ths liftPercent100thsValue = 1;
4273+
Percent100ths liftPercent100thsValue = 0;
42754274
}
42764275

42774276
request struct GoToTiltValueRequest {
42784277
INT16U tiltValue = 0;
42794278
}
42804279

42814280
request struct GoToTiltPercentageRequest {
4282-
Percent tiltPercentageValue = 0;
4283-
optional Percent100ths tiltPercent100thsValue = 1;
4281+
Percent100ths tiltPercent100thsValue = 0;
42844282
}
42854283

42864284
command UpOrOpen(): DefaultSuccess = 0;

src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java

+10-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java

+4-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/python/chip/clusters/CHIPClusters.py

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/python/chip/clusters/Objects.py

+4-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm

+2-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)