Skip to content

Commit 983fedf

Browse files
WindowCovering: Add operational-status + YAML tests (#14606)
* YAML: Update WindowCovering tests 3.1 3.2 to latest test plan * DEV: Expose and Use HasFeaturePas * DEV: Add mOperationalStatus var to class WindowApp * DEV: Add fake motion simulator for CI * DEV: add to All-cluster-app the missing callback * ZAP: Add missing diff from regen * YAML: Tests - Add Feature conditional PICS to WNCV 3.1 3.2 * CFG: ZAP all-cluster-app allows LF + PA_LF and TL + PA_TL by default * TEST: YAML update value and report * DEV: Add PostEvent for Attributes Changes * DEV: WindowAppImpl Add DispatchEventAttributeChange function * DEV: Remove StopMotion - prefer single method of goto current position * DEV: Rewrite position movement using attributes * DEV: Window-covering-server cleanup * DEV: Remove Todos we use PICS to enable/disable tests * TEST: YAML update WNCV 3.3 StopMotion * Test: YAML WNCV 3.3 disable steps relying on saveAS - add a todo on issue #14502 * TEST: Declare YAML test accordingly w/ Test Plan * TEST: YAML WNCV 3.2 fix target * TEST: YAML adjust timing * DEV: remove unused option from ConvertValue * DEV: Up or Down are inverted compare to the spec * CFG: Zap Window-app update feature-map * Restyled by whitespace * Restyled by clang-format * Restyled by prettier-yaml * DEV: Use generated callback rather than declaring one * DEV: Remove Post attribute declaration * Restyled by whitespace * Restyled by clang-format * YAML: Update attributes check * Rebase/Regen * Restyled by whitespace * TEST: YAML enable test on WNCV 3.3 - issue #14502 fixes by PR# 14602 * DEV: REbase / regen Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 45b2690 commit 983fedf

File tree

20 files changed

+4506
-609
lines changed

20 files changed

+4506
-609
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -11921,7 +11921,7 @@
1192111921
"storageOption": "RAM",
1192211922
"singleton": 0,
1192311923
"bounded": 0,
11924-
"defaultValue": "0",
11924+
"defaultValue": "0x17",
1192511925
"reportable": 1,
1192611926
"minInterval": 0,
1192711927
"maxInterval": 65344,

examples/window-app/common/include/WindowApp.h

+33-17
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
#pragma once
1919

20-
#include <app-common/zap-generated/enums.h>
21-
#include <app/util/af-types.h>
20+
#include <app/clusters/window-covering-server/window-covering-server.h>
2221
#include <lib/core/CHIPError.h>
2322

23+
using namespace chip::app::Clusters::WindowCovering;
24+
2425
class WindowApp
2526
{
2627
public:
@@ -76,13 +77,10 @@ class WindowApp
7677
CoverChange,
7778
CoverTypeChange,
7879
TiltModeChange,
79-
LiftUp,
80-
LiftDown,
81-
LiftChanged,
82-
TiltUp,
83-
TiltDown,
84-
TiltChanged,
85-
StopMotion,
80+
81+
// Cover Attribute update events
82+
AttributeChange,
83+
8684
// Provisioning events
8785
ProvisionedStateChanged,
8886
ConnectivityStateChanged,
@@ -95,32 +93,48 @@ class WindowApp
9593
{
9694
Event(EventId id) : mId(id), mEndpoint(0) {}
9795
Event(EventId id, chip::EndpointId endpoint) : mId(id), mEndpoint(endpoint) {}
96+
Event(EventId id, chip::EndpointId endpoint, chip::AttributeId attributeId) :
97+
mId(id), mEndpoint(endpoint), mAttributeId(attributeId)
98+
{}
9899

99100
EventId mId;
100101
chip::EndpointId mEndpoint;
102+
chip::AttributeId mAttributeId;
101103
};
102104

103105
struct Cover
104106
{
105107
void Init(chip::EndpointId endpoint);
106108
void Finish();
109+
110+
void LiftUpdate(bool newTarget);
111+
void LiftGoToTarget() { LiftUpdate(true); }
112+
void LiftContinueToTarget() { LiftUpdate(false); }
107113
void LiftUp();
108114
void LiftDown();
109-
void GotoLift(EventId action = EventId::None);
115+
116+
void TiltUpdate(bool newTarget);
117+
void TiltGoToTarget() { TiltUpdate(true); }
118+
void TiltContinueToTarget() { TiltUpdate(false); }
110119
void TiltUp();
111120
void TiltDown();
112-
void GotoTilt(EventId action = EventId::None);
113-
void StopMotion();
121+
114122
EmberAfWcType CycleType();
115123

116124
static void OnLiftTimeout(Timer & timer);
117125
static void OnTiltTimeout(Timer & timer);
118126

119127
chip::EndpointId mEndpoint = 0;
120-
Timer * mLiftTimer = nullptr;
121-
Timer * mTiltTimer = nullptr;
122-
EventId mLiftAction = EventId::None;
123-
EventId mTiltAction = EventId::None;
128+
129+
// Attribute: Id 10 OperationalStatus
130+
OperationalStatus mOperationalStatus = { .global = OperationalState::Stall,
131+
.lift = OperationalState::Stall,
132+
.tilt = OperationalState::Stall };
133+
134+
Timer * mLiftTimer = nullptr;
135+
Timer * mTiltTimer = nullptr;
136+
OperationalState mLiftOpState = OperationalState::Stall;
137+
OperationalState mTiltOpState = OperationalState::Stall;
124138
};
125139

126140
static WindowApp & Instance();
@@ -130,7 +144,8 @@ class WindowApp
130144
virtual CHIP_ERROR Start() = 0;
131145
virtual CHIP_ERROR Run();
132146
virtual void Finish();
133-
virtual void PostEvent(const Event & event) = 0;
147+
virtual void PostEvent(const Event & event) = 0;
148+
virtual void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeId) = 0;
134149

135150
protected:
136151
struct StateFlags
@@ -172,6 +187,7 @@ class WindowApp
172187

173188
private:
174189
void HandleLongPress();
190+
void DispatchEventAttributeChange(chip::EndpointId endpoint, chip::AttributeId attribute);
175191

176192
Cover mCoverList[WINDOW_COVER_COUNT];
177193
uint8_t mCurrentCover = 0;

0 commit comments

Comments
 (0)