Skip to content

Commit

Permalink
WindowCovering: Cleanup enum xml (project-chip#16992)
Browse files Browse the repository at this point in the history
* DEV: Update XML enum declaration and ZAP

* DEV: Update attribute access for Window-covering-server

* DEV: Update CycleType in WindowApp

* DEV: Update LCD painter to new enun + use uint16_t instead of uint8_t

* DEV: LCD Painter move namespace

* Test config disable test on WNCV 2.1

invalid operands to binary expression ('chip::app::Clusters::WindowCovering::EndProductType' and 'int')
CheckConstraintNotValue("endProductType", endProductType, 250)

* DEV: Fix missing update

* FIX: UpdateLCD must not be called outside the app Task

+ Update LCDPainter

* Restyled by clang-format

* DEV: remove comment useless

* fix: Includes: keep order in the right position from clang-format

* FIX: Remove leftover enum declaration from helper.js

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and chencheung committed Apr 6, 2022
1 parent c7723b3 commit 10168be
Show file tree
Hide file tree
Showing 33 changed files with 1,397 additions and 1,054 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3509,6 +3509,48 @@ server cluster WiFiNetworkDiagnostics = 54 {
}

server cluster WindowCovering = 258 {
enum EndProductType : ENUM8 {
kRollerShade = 0;
kRomanShade = 1;
kBalloonShade = 2;
kWovenWood = 3;
kPleatedShade = 4;
kCellularShade = 5;
kLayeredShade = 6;
kLayeredShade2D = 7;
kSheerShade = 8;
kTiltOnlyInteriorBlind = 9;
kInteriorBlind = 10;
kVerticalBlindStripCurtain = 11;
kInteriorVenetianBlind = 12;
kExteriorVenetianBlind = 13;
kLateralLeftCurtain = 14;
kLateralRightCurtain = 15;
kCentralCurtain = 16;
kRollerShutter = 17;
kExteriorVerticalScreen = 18;
kAwningTerracePatio = 19;
kAwningVerticalScreen = 20;
kTiltOnlyPergola = 21;
kSwingingShutter = 22;
kSlidingShutter = 23;
kUnknown = 255;
}

enum Type : ENUM8 {
kRollerShade = 0;
kRollerShade2Motor = 1;
kRollerShadeExterior = 2;
kRollerShadeExterior2Motor = 3;
kDrapery = 4;
kAwning = 5;
kShutter = 6;
kTiltBlindTiltOnly = 7;
kTiltBlindLiftAndTilt = 8;
kProjectorScreen = 9;
kUnknown = 255;
}

bitmap WcConfigStatus : BITMAP8 {
kOperational = 0x1;
kOnline = 0x2;
Expand All @@ -3531,7 +3573,7 @@ server cluster WindowCovering = 258 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLEDFeedback = 0x8;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
Expand All @@ -3555,7 +3597,7 @@ server cluster WindowCovering = 258 {
kProtection = 0x800;
}

readonly attribute enum8 type = 0;
readonly attribute Type type = 0;
readonly attribute nullable int16u currentPositionLift = 3;
readonly attribute nullable int16u currentPositionTilt = 4;
readonly attribute bitmap8 configStatus = 7;
Expand All @@ -3564,7 +3606,7 @@ server cluster WindowCovering = 258 {
readonly attribute bitmap8 operationalStatus = 10;
readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11;
readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12;
readonly attribute enum8 endProductType = 13;
readonly attribute EndProductType endProductType = 13;
readonly attribute nullable Percent100ths currentPositionLiftPercent100ths = 14;
readonly attribute nullable Percent100ths currentPositionTiltPercent100ths = 15;
readonly attribute int16u installedOpenLimitLift = 16;
Expand Down
48 changes: 45 additions & 3 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,48 @@ server cluster ThermostatUserInterfaceConfiguration = 516 {
}

server cluster WindowCovering = 258 {
enum EndProductType : ENUM8 {
kRollerShade = 0;
kRomanShade = 1;
kBalloonShade = 2;
kWovenWood = 3;
kPleatedShade = 4;
kCellularShade = 5;
kLayeredShade = 6;
kLayeredShade2D = 7;
kSheerShade = 8;
kTiltOnlyInteriorBlind = 9;
kInteriorBlind = 10;
kVerticalBlindStripCurtain = 11;
kInteriorVenetianBlind = 12;
kExteriorVenetianBlind = 13;
kLateralLeftCurtain = 14;
kLateralRightCurtain = 15;
kCentralCurtain = 16;
kRollerShutter = 17;
kExteriorVerticalScreen = 18;
kAwningTerracePatio = 19;
kAwningVerticalScreen = 20;
kTiltOnlyPergola = 21;
kSwingingShutter = 22;
kSlidingShutter = 23;
kUnknown = 255;
}

enum Type : ENUM8 {
kRollerShade = 0;
kRollerShade2Motor = 1;
kRollerShadeExterior = 2;
kRollerShadeExterior2Motor = 3;
kDrapery = 4;
kAwning = 5;
kShutter = 6;
kTiltBlindTiltOnly = 7;
kTiltBlindLiftAndTilt = 8;
kProjectorScreen = 9;
kUnknown = 255;
}

bitmap WcConfigStatus : BITMAP8 {
kOperational = 0x1;
kOnline = 0x2;
Expand All @@ -2013,7 +2055,7 @@ server cluster WindowCovering = 258 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLEDFeedback = 0x8;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
Expand All @@ -2037,7 +2079,7 @@ server cluster WindowCovering = 258 {
kProtection = 0x800;
}

readonly attribute enum8 type = 0;
readonly attribute Type type = 0;
readonly attribute nullable int16u currentPositionLift = 3;
readonly attribute nullable int16u currentPositionTilt = 4;
readonly attribute bitmap8 configStatus = 7;
Expand All @@ -2046,7 +2088,7 @@ server cluster WindowCovering = 258 {
readonly attribute bitmap8 operationalStatus = 10;
readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11;
readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12;
readonly attribute enum8 endProductType = 13;
readonly attribute EndProductType endProductType = 13;
readonly attribute nullable Percent100ths currentPositionLiftPercent100ths = 14;
readonly attribute nullable Percent100ths currentPositionTiltPercent100ths = 15;
readonly attribute int16u installedOpenLimitLift = 16;
Expand Down
48 changes: 45 additions & 3 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,48 @@ server cluster ThermostatUserInterfaceConfiguration = 516 {
}

server cluster WindowCovering = 258 {
enum EndProductType : ENUM8 {
kRollerShade = 0;
kRomanShade = 1;
kBalloonShade = 2;
kWovenWood = 3;
kPleatedShade = 4;
kCellularShade = 5;
kLayeredShade = 6;
kLayeredShade2D = 7;
kSheerShade = 8;
kTiltOnlyInteriorBlind = 9;
kInteriorBlind = 10;
kVerticalBlindStripCurtain = 11;
kInteriorVenetianBlind = 12;
kExteriorVenetianBlind = 13;
kLateralLeftCurtain = 14;
kLateralRightCurtain = 15;
kCentralCurtain = 16;
kRollerShutter = 17;
kExteriorVerticalScreen = 18;
kAwningTerracePatio = 19;
kAwningVerticalScreen = 20;
kTiltOnlyPergola = 21;
kSwingingShutter = 22;
kSlidingShutter = 23;
kUnknown = 255;
}

enum Type : ENUM8 {
kRollerShade = 0;
kRollerShade2Motor = 1;
kRollerShadeExterior = 2;
kRollerShadeExterior2Motor = 3;
kDrapery = 4;
kAwning = 5;
kShutter = 6;
kTiltBlindTiltOnly = 7;
kTiltBlindLiftAndTilt = 8;
kProjectorScreen = 9;
kUnknown = 255;
}

bitmap WcConfigStatus : BITMAP8 {
kOperational = 0x1;
kOnline = 0x2;
Expand All @@ -2013,7 +2055,7 @@ server cluster WindowCovering = 258 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLEDFeedback = 0x8;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
Expand All @@ -2037,7 +2079,7 @@ server cluster WindowCovering = 258 {
kProtection = 0x800;
}

readonly attribute enum8 type = 0;
readonly attribute Type type = 0;
readonly attribute nullable int16u currentPositionLift = 3;
readonly attribute nullable int16u currentPositionTilt = 4;
readonly attribute bitmap8 configStatus = 7;
Expand All @@ -2046,7 +2088,7 @@ server cluster WindowCovering = 258 {
readonly attribute bitmap8 operationalStatus = 10;
readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11;
readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12;
readonly attribute enum8 endProductType = 13;
readonly attribute EndProductType endProductType = 13;
readonly attribute nullable Percent100ths currentPositionLiftPercent100ths = 14;
readonly attribute nullable Percent100ths currentPositionTiltPercent100ths = 15;
readonly attribute int16u installedOpenLimitLift = 16;
Expand Down
2 changes: 1 addition & 1 deletion examples/window-app/common/include/WindowApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class WindowApp

void StepToward(OperationalState direction, bool isTilt);

EmberAfWcType CycleType();
Type CycleType();

static void OnLiftTimeout(Timer & timer);
static void OnTiltTimeout(Timer & timer);
Expand Down
28 changes: 14 additions & 14 deletions examples/window-app/common/src/WindowApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ void WindowApp::HandleLongPress()
else if (mDownPressed)
{
// Long press button down: Cycle between covering types
mDownSuppressed = true;
EmberAfWcType cover_type = GetCover().CycleType();
mTiltMode = mTiltMode && (EMBER_ZCL_WC_TYPE_TILT_BLIND_LIFT_AND_TILT == cover_type);
mDownSuppressed = true;
Type type = GetCover().CycleType();
mTiltMode = mTiltMode && (Type::kTiltBlindLiftAndTilt == type);
}
}

Expand Down Expand Up @@ -412,7 +412,7 @@ void WindowApp::Cover::Init(chip::EndpointId endpoint)
// Note: All Current Positions are preset via Zap config and kept accross reboot via NVM: no need to init them

// Attribute: Id 0 Type
TypeSet(endpoint, EMBER_ZCL_WC_TYPE_TILT_BLIND_LIFT_AND_TILT);
TypeSet(endpoint, Type::kTiltBlindLiftAndTilt);

// Attribute: Id 7 ConfigStatus
ConfigStatus configStatus = { .operational = 1,
Expand All @@ -427,7 +427,7 @@ void WindowApp::Cover::Init(chip::EndpointId endpoint)
OperationalStatusSetWithGlobalUpdated(endpoint, mOperationalStatus);

// Attribute: Id 13 EndProductType
EndProductTypeSet(endpoint, EMBER_ZCL_WC_END_PRODUCT_TYPE_INTERIOR_BLIND);
EndProductTypeSet(endpoint, EndProductType::kInteriorBlind);

// Attribute: Id 24 Mode
Mode mode = { .motorDirReversed = 0, .calibrationMode = 1, .maintenanceMode = 1, .ledDisplay = 1 };
Expand Down Expand Up @@ -588,27 +588,27 @@ void WindowApp::Cover::StepToward(OperationalState direction, bool isTilt)
}
}

EmberAfWcType WindowApp::Cover::CycleType()
Type WindowApp::Cover::CycleType()
{
chip::DeviceLayer::PlatformMgr().LockChipStack();
EmberAfWcType type = TypeGet(mEndpoint);
Type type = TypeGet(mEndpoint);
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

switch (type)
{
case EMBER_ZCL_WC_TYPE_ROLLERSHADE:
type = EMBER_ZCL_WC_TYPE_DRAPERY;
case Type::kRollerShade:
type = Type::kDrapery;
// tilt = false;
break;
case EMBER_ZCL_WC_TYPE_DRAPERY:
type = EMBER_ZCL_WC_TYPE_TILT_BLIND_LIFT_AND_TILT;
case Type::kDrapery:
type = Type::kTiltBlindLiftAndTilt;
break;
case EMBER_ZCL_WC_TYPE_TILT_BLIND_LIFT_AND_TILT:
type = EMBER_ZCL_WC_TYPE_ROLLERSHADE;
case Type::kTiltBlindLiftAndTilt:
type = Type::kRollerShade;
// tilt = false;
break;
default:
type = EMBER_ZCL_WC_TYPE_TILT_BLIND_LIFT_AND_TILT;
type = Type::kTiltBlindLiftAndTilt;
}

chip::DeviceLayer::PlatformMgr().LockChipStack();
Expand Down
48 changes: 45 additions & 3 deletions examples/window-app/common/window-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,48 @@ server cluster WiFiNetworkDiagnostics = 54 {
}

server cluster WindowCovering = 258 {
enum EndProductType : ENUM8 {
kRollerShade = 0;
kRomanShade = 1;
kBalloonShade = 2;
kWovenWood = 3;
kPleatedShade = 4;
kCellularShade = 5;
kLayeredShade = 6;
kLayeredShade2D = 7;
kSheerShade = 8;
kTiltOnlyInteriorBlind = 9;
kInteriorBlind = 10;
kVerticalBlindStripCurtain = 11;
kInteriorVenetianBlind = 12;
kExteriorVenetianBlind = 13;
kLateralLeftCurtain = 14;
kLateralRightCurtain = 15;
kCentralCurtain = 16;
kRollerShutter = 17;
kExteriorVerticalScreen = 18;
kAwningTerracePatio = 19;
kAwningVerticalScreen = 20;
kTiltOnlyPergola = 21;
kSwingingShutter = 22;
kSlidingShutter = 23;
kUnknown = 255;
}

enum Type : ENUM8 {
kRollerShade = 0;
kRollerShade2Motor = 1;
kRollerShadeExterior = 2;
kRollerShadeExterior2Motor = 3;
kDrapery = 4;
kAwning = 5;
kShutter = 6;
kTiltBlindTiltOnly = 7;
kTiltBlindLiftAndTilt = 8;
kProjectorScreen = 9;
kUnknown = 255;
}

bitmap WcConfigStatus : BITMAP8 {
kOperational = 0x1;
kOnline = 0x2;
Expand All @@ -1114,7 +1156,7 @@ server cluster WindowCovering = 258 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLEDFeedback = 0x8;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
Expand All @@ -1138,7 +1180,7 @@ server cluster WindowCovering = 258 {
kProtection = 0x800;
}

readonly attribute enum8 type = 0;
readonly attribute Type type = 0;
readonly attribute nullable int16u currentPositionLift = 3;
readonly attribute nullable int16u currentPositionTilt = 4;
readonly attribute bitmap8 configStatus = 7;
Expand All @@ -1147,7 +1189,7 @@ server cluster WindowCovering = 258 {
readonly attribute bitmap8 operationalStatus = 10;
readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11;
readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12;
readonly attribute enum8 endProductType = 13;
readonly attribute EndProductType endProductType = 13;
readonly attribute nullable Percent100ths currentPositionLiftPercent100ths = 14;
readonly attribute nullable Percent100ths currentPositionTiltPercent100ths = 15;
readonly attribute int16u installedOpenLimitLift = 16;
Expand Down
Loading

0 comments on commit 10168be

Please sign in to comment.