Skip to content

Commit

Permalink
WindowCovering: Support of WNCV_2_3 + refactor of Mode/ConfigStatus (#…
Browse files Browse the repository at this point in the history
…17429)

* ZAP: Rework Mode + ConfigStatus declaration

* ZAP: Rework GoTo with Percent100ths as optional

* YAML + ZAP: Remove tests on Mode and ConfigStatus

* DEV: ReWork ConfigStatus init and functions

* DEV: Update Mode behavior + init + functions

* DEV: Check current mode for command + rework optional GoTos params

* YAML: disabled non-compatible test on WNCV-2.1

* YAML: Update test WNCV_2.3

- fix PICS

* DEV: Add support for test constraints Min/Max w/ BitFlags<T>

* DEV: Add support for test constraints NotValue w/ BitFlags<T>

* YAML: ReEnable BitFlags related tests

* DEV: Add WNCV ci-pics-values

* YAML: Activate 2.3 test in chip-tools

* [DEV] Add autogen tests for WNCV 2.3

* YAML: Remove Manual Test WNCV 2.3

* YAML: Add missing WaitForCommissionee

* Zap: Regen config for 2.3 WNCV test

* FIX: Issue with locking

* Restyled by whitespace

* Restyled by clang-format

* Restyled by prettier-yaml

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

Co-authored-by: Boris Zbarsky <[email protected]>

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Sep 6, 2023
1 parent 53d2fc8 commit 604e51e
Show file tree
Hide file tree
Showing 43 changed files with 2,947 additions and 705 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3620,16 +3620,23 @@ server cluster WindowCovering = 258 {
kUnknown = 255;
}

bitmap WcConfigStatus : BITMAP8 {
bitmap ConfigStatus : BITMAP8 {
kOperational = 0x1;
kOnline = 0x2;
kOpenAndUpCommandsReversed = 0x4;
kOnlineReserved = 0x2;
kLiftMovementReversed = 0x4;
kLiftPositionAware = 0x8;
kTiltPositionAware = 0x10;
kLiftEncoderControlled = 0x20;
kTiltEncoderControlled = 0x40;
}

bitmap Mode : BITMAP8 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLedFeedback = 0x8;
}

bitmap WcFeature : BITMAP32 {
kLift = 0x1;
kTilt = 0x2;
Expand All @@ -3638,13 +3645,6 @@ server cluster WindowCovering = 258 {
kPositionAwareTilt = 0x10;
}

bitmap WcMode : BITMAP8 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
kGlobal = 0x3;
kLift = 0xC;
Expand All @@ -3669,7 +3669,7 @@ server cluster WindowCovering = 258 {
readonly attribute Type type = 0;
readonly attribute nullable int16u currentPositionLift = 3;
readonly attribute nullable int16u currentPositionTilt = 4;
readonly attribute bitmap8 configStatus = 7;
readonly attribute ConfigStatus configStatus = 7;
readonly attribute nullable Percent currentPositionLiftPercentage = 8;
readonly attribute nullable Percent currentPositionTiltPercentage = 9;
readonly attribute bitmap8 operationalStatus = 10;
Expand All @@ -3682,7 +3682,7 @@ server cluster WindowCovering = 258 {
readonly attribute int16u installedClosedLimitLift = 17;
readonly attribute int16u installedOpenLimitTilt = 18;
readonly attribute int16u installedClosedLimitTilt = 19;
attribute access(write: manage) bitmap8 mode = 23;
attribute access(write: manage) Mode mode = 23;
readonly attribute bitmap16 safetyStatus = 26;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
Expand All @@ -3693,7 +3693,7 @@ server cluster WindowCovering = 258 {

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

request struct GoToTiltValueRequest {
Expand All @@ -3702,7 +3702,7 @@ server cluster WindowCovering = 258 {

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

command UpOrOpen(): DefaultSuccess = 0;
Expand Down
1 change: 1 addition & 0 deletions examples/chip-tool-darwin/templates/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ function getTests()
'Test_TC_WNCV_1_1',
'Test_TC_WNCV_2_1',
'Test_TC_WNCV_2_2',
'Test_TC_WNCV_2_3',
'Test_TC_WNCV_2_4',
'Test_TC_WNCV_2_5',
//'Test_TC_WNCV_3_1',
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/templates/tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ function getManualTests()
];

const WindowCovering = [
'Test_TC_WNCV_2_3',
'Test_TC_WNCV_6_1',
];

Expand Down Expand Up @@ -502,6 +501,7 @@ function getTests()
'Test_TC_WNCV_1_1',
'Test_TC_WNCV_2_1',
'Test_TC_WNCV_2_2',
'Test_TC_WNCV_2_3',
'Test_TC_WNCV_2_4',
'Test_TC_WNCV_2_5',
'Test_TC_WNCV_3_1',
Expand Down
28 changes: 14 additions & 14 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2430,16 +2430,23 @@ server cluster WindowCovering = 258 {
kUnknown = 255;
}

bitmap WcConfigStatus : BITMAP8 {
bitmap ConfigStatus : BITMAP8 {
kOperational = 0x1;
kOnline = 0x2;
kOpenAndUpCommandsReversed = 0x4;
kOnlineReserved = 0x2;
kLiftMovementReversed = 0x4;
kLiftPositionAware = 0x8;
kTiltPositionAware = 0x10;
kLiftEncoderControlled = 0x20;
kTiltEncoderControlled = 0x40;
}

bitmap Mode : BITMAP8 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLedFeedback = 0x8;
}

bitmap WcFeature : BITMAP32 {
kLift = 0x1;
kTilt = 0x2;
Expand All @@ -2448,13 +2455,6 @@ server cluster WindowCovering = 258 {
kPositionAwareTilt = 0x10;
}

bitmap WcMode : BITMAP8 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
kGlobal = 0x3;
kLift = 0xC;
Expand All @@ -2479,7 +2479,7 @@ server cluster WindowCovering = 258 {
readonly attribute Type type = 0;
readonly attribute nullable int16u currentPositionLift = 3;
readonly attribute nullable int16u currentPositionTilt = 4;
readonly attribute bitmap8 configStatus = 7;
readonly attribute ConfigStatus configStatus = 7;
readonly attribute nullable Percent currentPositionLiftPercentage = 8;
readonly attribute nullable Percent currentPositionTiltPercentage = 9;
readonly attribute bitmap8 operationalStatus = 10;
Expand All @@ -2492,7 +2492,7 @@ server cluster WindowCovering = 258 {
readonly attribute int16u installedClosedLimitLift = 17;
readonly attribute int16u installedOpenLimitTilt = 18;
readonly attribute int16u installedClosedLimitTilt = 19;
attribute access(write: manage) bitmap8 mode = 23;
attribute access(write: manage) Mode mode = 23;
readonly attribute bitmap16 safetyStatus = 26;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
Expand All @@ -2503,7 +2503,7 @@ server cluster WindowCovering = 258 {

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

request struct GoToTiltValueRequest {
Expand All @@ -2512,7 +2512,7 @@ server cluster WindowCovering = 258 {

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

command UpOrOpen(): DefaultSuccess = 0;
Expand Down
28 changes: 14 additions & 14 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2430,16 +2430,23 @@ server cluster WindowCovering = 258 {
kUnknown = 255;
}

bitmap WcConfigStatus : BITMAP8 {
bitmap ConfigStatus : BITMAP8 {
kOperational = 0x1;
kOnline = 0x2;
kOpenAndUpCommandsReversed = 0x4;
kOnlineReserved = 0x2;
kLiftMovementReversed = 0x4;
kLiftPositionAware = 0x8;
kTiltPositionAware = 0x10;
kLiftEncoderControlled = 0x20;
kTiltEncoderControlled = 0x40;
}

bitmap Mode : BITMAP8 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLedFeedback = 0x8;
}

bitmap WcFeature : BITMAP32 {
kLift = 0x1;
kTilt = 0x2;
Expand All @@ -2448,13 +2455,6 @@ server cluster WindowCovering = 258 {
kPositionAwareTilt = 0x10;
}

bitmap WcMode : BITMAP8 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
kGlobal = 0x3;
kLift = 0xC;
Expand All @@ -2479,7 +2479,7 @@ server cluster WindowCovering = 258 {
readonly attribute Type type = 0;
readonly attribute nullable int16u currentPositionLift = 3;
readonly attribute nullable int16u currentPositionTilt = 4;
readonly attribute bitmap8 configStatus = 7;
readonly attribute ConfigStatus configStatus = 7;
readonly attribute nullable Percent currentPositionLiftPercentage = 8;
readonly attribute nullable Percent currentPositionTiltPercentage = 9;
readonly attribute bitmap8 operationalStatus = 10;
Expand All @@ -2492,7 +2492,7 @@ server cluster WindowCovering = 258 {
readonly attribute int16u installedClosedLimitLift = 17;
readonly attribute int16u installedOpenLimitTilt = 18;
readonly attribute int16u installedClosedLimitTilt = 19;
attribute access(write: manage) bitmap8 mode = 23;
attribute access(write: manage) Mode mode = 23;
readonly attribute bitmap16 safetyStatus = 26;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
Expand All @@ -2503,7 +2503,7 @@ server cluster WindowCovering = 258 {

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

request struct GoToTiltValueRequest {
Expand All @@ -2512,7 +2512,7 @@ server cluster WindowCovering = 258 {

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

command UpOrOpen(): DefaultSuccess = 0;
Expand Down
36 changes: 25 additions & 11 deletions examples/window-app/common/src/WindowApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ void WindowApp::DispatchEvent(const WindowApp::Event & event)
void WindowApp::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::AttributeId attribute)
{
Cover * cover = GetCover(endpoint);
chip::BitFlags<Mode> mode;
chip::BitFlags<ConfigStatus> configStatus;

if (nullptr == cover)
{
Expand All @@ -319,15 +321,24 @@ void WindowApp::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::At
break;
/* RW Mode */
case Attributes::Mode::Id:
emberAfWindowCoveringClusterPrint("Mode set: ignored");
chip::DeviceLayer::PlatformMgr().LockChipStack();
mode = ModeGet(endpoint);
ModePrint(mode);
ModeSet(endpoint, mode); // refilter mode if needed
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
break;
/* RO ConfigStatus: set by WC server */
case Attributes::ConfigStatus::Id:
chip::DeviceLayer::PlatformMgr().LockChipStack();
configStatus = ConfigStatusGet(endpoint);
ConfigStatusPrint(configStatus);
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
break;
/* ### ATTRIBUTEs CHANGEs IGNORED ### */
/* RO Type: not supposed to dynamically change */
case Attributes::Type::Id:
/* RO EndProductType: not supposed to dynamically change */
case Attributes::EndProductType::Id:
/* RO ConfigStatus: set by WC server */
case Attributes::ConfigStatus::Id:
/* RO SafetyStatus: set by WC server */
case Attributes::SafetyStatus::Id:
/* ============= Positions for Position Aware ============= */
Expand Down Expand Up @@ -415,13 +426,10 @@ void WindowApp::Cover::Init(chip::EndpointId endpoint)
TypeSet(endpoint, Type::kTiltBlindLiftAndTilt);

// Attribute: Id 7 ConfigStatus
ConfigStatus configStatus = { .operational = 1,
.online = 1,
.liftIsReversed = 0,
.liftIsPA = HasFeaturePaLift(endpoint),
.tiltIsPA = HasFeaturePaTilt(endpoint),
.liftIsEncoderControlled = 1,
.tiltIsEncoderControlled = 1 };
chip::BitFlags<ConfigStatus> configStatus = ConfigStatusGet(endpoint);
configStatus.Set(ConfigStatus::kLiftEncoderControlled);
configStatus.Set(ConfigStatus::kTiltEncoderControlled);
configStatus.Set(ConfigStatus::kOnlineReserved);
ConfigStatusSet(endpoint, configStatus);

OperationalStatusSetWithGlobalUpdated(endpoint, mOperationalStatus);
Expand All @@ -430,7 +438,13 @@ void WindowApp::Cover::Init(chip::EndpointId endpoint)
EndProductTypeSet(endpoint, EndProductType::kInteriorBlind);

// Attribute: Id 24 Mode
Mode mode = { .motorDirReversed = 0, .calibrationMode = 1, .maintenanceMode = 1, .ledDisplay = 1 };
chip::BitFlags<Mode> mode;
mode.Clear(Mode::kMotorDirectionReversed);
mode.Clear(Mode::kMaintenanceMode);
mode.Clear(Mode::kCalibrationMode);
mode.Set(Mode::kLedFeedback);

/* Mode also update ConfigStatus accordingly */
ModeSet(endpoint, mode);

// Attribute: Id 27 SafetyStatus (Optional)
Expand Down
Loading

0 comments on commit 604e51e

Please sign in to comment.