Skip to content

Commit

Permalink
WindowCovering: GoTos command field optional (#17923)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
2 people authored and pull[bot] committed Sep 14, 2023
1 parent 7b4a7ff commit 6012965
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3736,17 +3736,15 @@ server cluster WindowCovering = 258 {
}

request struct GoToLiftPercentageRequest {
Percent liftPercentageValue = 0;
optional Percent100ths liftPercent100thsValue = 1;
Percent100ths liftPercent100thsValue = 0;
}

request struct GoToTiltValueRequest {
INT16U tiltValue = 0;
}

request struct GoToTiltPercentageRequest {
Percent tiltPercentageValue = 0;
optional Percent100ths tiltPercent100thsValue = 1;
Percent100ths tiltPercent100thsValue = 0;
}

command UpOrOpen(): DefaultSuccess = 0;
Expand Down
6 changes: 2 additions & 4 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2502,17 +2502,15 @@ server cluster WindowCovering = 258 {
}

request struct GoToLiftPercentageRequest {
Percent liftPercentageValue = 0;
optional Percent100ths liftPercent100thsValue = 1;
Percent100ths liftPercent100thsValue = 0;
}

request struct GoToTiltValueRequest {
INT16U tiltValue = 0;
}

request struct GoToTiltPercentageRequest {
Percent tiltPercentageValue = 0;
optional Percent100ths tiltPercent100thsValue = 1;
Percent100ths tiltPercent100thsValue = 0;
}

command UpOrOpen(): DefaultSuccess = 0;
Expand Down
6 changes: 2 additions & 4 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2502,17 +2502,15 @@ server cluster WindowCovering = 258 {
}

request struct GoToLiftPercentageRequest {
Percent liftPercentageValue = 0;
optional Percent100ths liftPercent100thsValue = 1;
Percent100ths liftPercent100thsValue = 0;
}

request struct GoToTiltValueRequest {
INT16U tiltValue = 0;
}

request struct GoToTiltPercentageRequest {
Percent tiltPercentageValue = 0;
optional Percent100ths tiltPercent100thsValue = 1;
Percent100ths tiltPercent100thsValue = 0;
}

command UpOrOpen(): DefaultSuccess = 0;
Expand Down
6 changes: 2 additions & 4 deletions examples/window-app/common/window-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1509,17 +1509,15 @@ server cluster WindowCovering = 258 {
}

request struct GoToLiftPercentageRequest {
Percent liftPercentageValue = 0;
optional Percent100ths liftPercent100thsValue = 1;
Percent100ths liftPercent100thsValue = 0;
}

request struct GoToTiltValueRequest {
INT16U tiltValue = 0;
}

request struct GoToTiltPercentageRequest {
Percent tiltPercentageValue = 0;
optional Percent100ths tiltPercent100thsValue = 1;
Percent100ths tiltPercent100thsValue = 0;
}

command UpOrOpen(): DefaultSuccess = 0;
Expand Down
28 changes: 10 additions & 18 deletions src/app/clusters/window-covering-server/window-covering-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,14 +844,10 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler
const app::ConcreteCommandPath & commandPath,
const Commands::GoToLiftPercentage::DecodableType & commandData)
{
auto & liftPercentageValue = commandData.liftPercentageValue;
auto & liftPercent100thsValue = commandData.liftPercent100thsValue;
Percent100ths liftPercent100ths =
liftPercent100thsValue.ValueOr(static_cast<Percent100ths>(liftPercentageValue * WC_PERCENT100THS_COEF));
Percent100ths percent100ths = commandData.liftPercent100thsValue;
EndpointId endpoint = commandPath.mEndpointId;

EndpointId endpoint = commandPath.mEndpointId;

emberAfWindowCoveringClusterPrint("GoToLiftPercentage %u%% %u command received", liftPercentageValue, liftPercent100ths);
emberAfWindowCoveringClusterPrint("GoToLiftPercentage %u command received", percent100ths);

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

if (HasFeaturePaLift(endpoint))
{
if (IsPercent100thsValid(liftPercent100ths))
if (IsPercent100thsValid(percent100ths))
{
Attributes::TargetPositionLiftPercent100ths::Set(endpoint, liftPercent100ths);
Attributes::TargetPositionLiftPercent100ths::Set(endpoint, percent100ths);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
}
else
Expand Down Expand Up @@ -922,14 +918,10 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler
const app::ConcreteCommandPath & commandPath,
const Commands::GoToTiltPercentage::DecodableType & commandData)
{
auto & tiltPercentageValue = commandData.tiltPercentageValue;
auto & tiltPercent100thsValue = commandData.tiltPercent100thsValue;
Percent100ths tiltPercent100ths =
tiltPercent100thsValue.ValueOr(static_cast<Percent100ths>(tiltPercentageValue * WC_PERCENT100THS_COEF));

EndpointId endpoint = commandPath.mEndpointId;
Percent100ths percent100ths = commandData.tiltPercent100thsValue;
EndpointId endpoint = commandPath.mEndpointId;

emberAfWindowCoveringClusterPrint("GoToTiltPercentage %u%% %u command received", tiltPercentageValue, tiltPercent100ths);
emberAfWindowCoveringClusterPrint("GoToTiltPercentage %u command received", percent100ths);

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

if (HasFeaturePaTilt(endpoint))
{
if (IsPercent100thsValid(tiltPercent100ths))
if (IsPercent100thsValid(percent100ths))
{
Attributes::TargetPositionTiltPercent100ths::Set(endpoint, tiltPercent100ths);
Attributes::TargetPositionTiltPercent100ths::Set(endpoint, percent100ths);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ typedef DataModel::Nullable<Percent> NPercent;
typedef DataModel::Nullable<Percent100ths> NPercent100ths;
typedef DataModel::Nullable<uint16_t> NAbsolute;

typedef Optional<Percent> OPercent;
typedef Optional<Percent100ths> OPercent100ths;
// Match directly with OperationalStatus 2 bits Fields
enum class OperationalState : uint8_t
{
Expand Down
6 changes: 2 additions & 4 deletions src/app/zap-templates/zcl/data-model/chip/window-covering.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ limitations under the License.
<!-- Conformance feature LF & PA_LF | [LF] - for now optional -->
<command source="client" code="0x05" name="GoToLiftPercentage" optional="true" cli="zcl WindowCovering GoToLiftPercentage">
<description>Go to lift percentage specified</description>
<arg name="liftPercentageValue" type="Percent"/>
<arg name="liftPercent100thsValue" type="Percent100ths" optional="true"/>
<arg name="liftPercent100thsValue" type="Percent100ths"/>
</command>
<!-- Conformance feature [TL & ABS] - for now optional -->
<command source="client" code="0x07" name="GoToTiltValue" optional="true" cli="zcl WindowCovering GoToTiltValue">
Expand All @@ -120,8 +119,7 @@ limitations under the License.
<!-- Conformance feature TL & PA_TL | [TL] - for now optional -->
<command source="client" code="0x08" name="GoToTiltPercentage" optional="true" cli="zcl WindowCovering GoToTiltPercentage">
<description>Go to tilt percentage specified</description>
<arg name="tiltPercentageValue" type="Percent"/>
<arg name="tiltPercent100thsValue" type="Percent100ths" optional="true"/>
<arg name="tiltPercent100thsValue" type="Percent100ths"/>
</command>
</cluster>

Expand Down
6 changes: 2 additions & 4 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -4270,17 +4270,15 @@ client cluster WindowCovering = 258 {
}

request struct GoToLiftPercentageRequest {
Percent liftPercentageValue = 0;
optional Percent100ths liftPercent100thsValue = 1;
Percent100ths liftPercent100thsValue = 0;
}

request struct GoToTiltValueRequest {
INT16U tiltValue = 0;
}

request struct GoToTiltPercentageRequest {
Percent tiltPercentageValue = 0;
optional Percent100ths tiltPercent100thsValue = 1;
Percent100ths tiltPercent100thsValue = 0;
}

command UpOrOpen(): DefaultSuccess = 0;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/controller/python/chip/clusters/CHIPClusters.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions src/controller/python/chip/clusters/Objects.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6012965

Please sign in to comment.