Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindowCovering: Cleanup enum xml #16992

Merged
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -3501,6 +3501,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 @@ -3523,7 +3565,7 @@ server cluster WindowCovering = 258 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLEDFeedback = 0x8;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
Expand All @@ -3547,7 +3589,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 @@ -3556,7 +3598,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 @@ -1983,6 +1983,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 @@ -2005,7 +2047,7 @@ server cluster WindowCovering = 258 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLEDFeedback = 0x8;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
Expand All @@ -2029,7 +2071,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 @@ -2038,7 +2080,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 @@ -1983,6 +1983,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 @@ -2005,7 +2047,7 @@ server cluster WindowCovering = 258 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLEDFeedback = 0x8;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
Expand All @@ -2029,7 +2071,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 @@ -2038,7 +2080,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 @@ -1084,6 +1084,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 @@ -1106,7 +1148,7 @@ server cluster WindowCovering = 258 {
kMotorDirectionReversed = 0x1;
kCalibrationMode = 0x2;
kMaintenanceMode = 0x4;
kLEDFeedback = 0x8;
kLedFeedback = 0x8;
}

bitmap WcOperationalStatus : BITMAP8 {
Expand All @@ -1130,7 +1172,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 @@ -1139,7 +1181,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