Skip to content

Commit 6c6b11f

Browse files
Add DirectModeChange feature to RVC Run Mode and RVC Clean Mode cluster XML and all-clusters-app implementation (project-chip#35258)
* Add DirectModeChange feature to RVC Run Mode and RVC Clean Mode cluster XML. * Run update_cluster_revisions.py to update to the new RVC Run Mode cluster revision. * Run update_cluster_revisions.py to update to the new RVC Clean Mode cluster revision. * Regenerate generated code.
1 parent 9bbf5b9 commit 6c6b11f

File tree

18 files changed

+99
-81
lines changed

18 files changed

+99
-81
lines changed

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -3235,7 +3235,7 @@ cluster LaundryWasherControls = 83 {
32353235

32363236
/** Attributes and commands for selecting a mode from a list of supported options. */
32373237
cluster RvcRunMode = 84 {
3238-
revision 2;
3238+
revision 3;
32393239

32403240
enum ModeTag : enum16 {
32413241
kIdle = 16384;
@@ -3255,7 +3255,7 @@ cluster RvcRunMode = 84 {
32553255
}
32563256

32573257
bitmap Feature : bitmap32 {
3258-
kNoFeatures = 0x0;
3258+
kDirectModeChange = 0x10000;
32593259
}
32603260

32613261
struct ModeTagStruct {
@@ -3294,7 +3294,7 @@ cluster RvcRunMode = 84 {
32943294

32953295
/** Attributes and commands for selecting a mode from a list of supported options. */
32963296
cluster RvcCleanMode = 85 {
3297-
revision 2;
3297+
revision 3;
32983298

32993299
enum ModeTag : enum16 {
33003300
kDeepClean = 16384;
@@ -3307,7 +3307,7 @@ cluster RvcCleanMode = 85 {
33073307
}
33083308

33093309
bitmap Feature : bitmap32 {
3310-
kNoFeatures = 0x0;
3310+
kDirectModeChange = 0x10000;
33113311
}
33123312

33133313
struct ModeTagStruct {
@@ -8489,7 +8489,7 @@ endpoint 1 {
84898489
callback attribute eventList;
84908490
callback attribute attributeList;
84918491
callback attribute featureMap;
8492-
ram attribute clusterRevision default = 2;
8492+
ram attribute clusterRevision default = 3;
84938493

84948494
handle command ChangeToMode;
84958495
handle command ChangeToModeResponse;
@@ -8503,7 +8503,7 @@ endpoint 1 {
85038503
callback attribute eventList;
85048504
callback attribute attributeList;
85058505
callback attribute featureMap;
8506-
ram attribute clusterRevision default = 2;
8506+
ram attribute clusterRevision default = 3;
85078507

85088508
handle command ChangeToMode;
85098509
handle command ChangeToModeResponse;

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -9648,7 +9648,7 @@
96489648
"storageOption": "RAM",
96499649
"singleton": 0,
96509650
"bounded": 0,
9651-
"defaultValue": "2",
9651+
"defaultValue": "3",
96529652
"reportable": 1,
96539653
"minInterval": 1,
96549654
"maxInterval": 65534,
@@ -9804,7 +9804,7 @@
98049804
"storageOption": "RAM",
98059805
"singleton": 0,
98069806
"bounded": 0,
9807-
"defaultValue": "2",
9807+
"defaultValue": "3",
98089808
"reportable": 1,
98099809
"minInterval": 1,
98109810
"maxInterval": 65534,

examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp

+23-16
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818
#include <app-common/zap-generated/attributes/Accessors.h>
19+
#include <lib/support/TypeTraits.h>
1920
#include <rvc-modes.h>
2021
#include <rvc-operational-state-delegate-impl.h>
2122

@@ -41,12 +42,15 @@ void RvcRunModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands:
4142
{
4243
uint8_t currentMode = mInstance->GetCurrentMode();
4344

44-
// Our business logic states that we can only switch into a running mode from the idle state.
45-
if (NewMode != RvcRunMode::ModeIdle && currentMode != RvcRunMode::ModeIdle)
45+
if (!gRvcRunModeInstance->HasFeature(static_cast<ModeBase::Feature>(RvcRunMode::Feature::kDirectModeChange)))
4646
{
47-
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
48-
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to a running mode is only allowed from idle"));
49-
return;
47+
// Our business logic states that we can only switch into a running mode from the idle state.
48+
if (NewMode != RvcRunMode::ModeIdle && currentMode != RvcRunMode::ModeIdle)
49+
{
50+
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
51+
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to a running mode is only allowed from idle"));
52+
return;
53+
}
5054
}
5155

5256
auto rvcOpStateInstance = RvcOperationalState::GetRvcOperationalStateInstance();
@@ -123,8 +127,8 @@ void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId)
123127
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
124128
VerifyOrDie(gRvcRunModeDelegate == nullptr && gRvcRunModeInstance == nullptr);
125129
gRvcRunModeDelegate = new RvcRunMode::RvcRunModeDelegate;
126-
gRvcRunModeInstance =
127-
new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, chip::to_underlying(RvcRunMode::Feature::kNoFeatures));
130+
gRvcRunModeInstance = new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id,
131+
chip::to_underlying(RvcRunMode::Feature::kDirectModeChange));
128132
gRvcRunModeInstance->Init();
129133
}
130134

@@ -139,14 +143,17 @@ CHIP_ERROR RvcCleanModeDelegate::Init()
139143

140144
void RvcCleanModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type & response)
141145
{
142-
uint8_t rvcRunCurrentMode = gRvcRunModeInstance->GetCurrentMode();
143-
144-
if (rvcRunCurrentMode != RvcRunMode::ModeIdle)
146+
if (!gRvcCleanModeInstance->HasFeature(static_cast<ModeBase::Feature>(RvcCleanMode::Feature::kDirectModeChange)))
145147
{
146-
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
147-
response.statusText.SetValue(
148-
chip::CharSpan::fromCharString("Cannot change the cleaning mode when the device is not in idle"));
149-
return;
148+
uint8_t rvcRunCurrentMode = gRvcRunModeInstance->GetCurrentMode();
149+
150+
if (rvcRunCurrentMode != RvcRunMode::ModeIdle)
151+
{
152+
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
153+
response.statusText.SetValue(
154+
chip::CharSpan::fromCharString("Cannot change the cleaning mode when the device is not in idle"));
155+
return;
156+
}
150157
}
151158

152159
response.status = to_underlying(ModeBase::StatusCode::kSuccess);
@@ -213,7 +220,7 @@ void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId)
213220
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
214221
VerifyOrDie(gRvcCleanModeDelegate == nullptr && gRvcCleanModeInstance == nullptr);
215222
gRvcCleanModeDelegate = new RvcCleanMode::RvcCleanModeDelegate;
216-
gRvcCleanModeInstance =
217-
new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, chip::to_underlying(RvcRunMode::Feature::kNoFeatures));
223+
gRvcCleanModeInstance = new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id,
224+
chip::to_underlying(RvcCleanMode::Feature::kDirectModeChange));
218225
gRvcCleanModeInstance->Init();
219226
}

examples/chef/common/chef-rvc-mode-delegate.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId)
154154
VerifyOrDie(!gRvcRunModeDelegate && !gRvcRunModeInstance);
155155

156156
gRvcRunModeDelegate = std::make_unique<RvcRunModeDelegate>();
157-
gRvcRunModeInstance = std::make_unique<ModeBase::Instance>(gRvcRunModeDelegate.get(), endpointId, RvcRunMode::Id,
158-
chip::to_underlying(RvcRunMode::Feature::kNoFeatures));
157+
gRvcRunModeInstance =
158+
std::make_unique<ModeBase::Instance>(gRvcRunModeDelegate.get(), endpointId, RvcRunMode::Id, 0 /* No feature bits */);
159159
gRvcRunModeInstance->Init();
160160
}
161161

@@ -290,8 +290,8 @@ void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId)
290290
VerifyOrDie(!gRvcCleanModeDelegate && !gRvcCleanModeInstance);
291291

292292
gRvcCleanModeDelegate = std::make_unique<RvcCleanModeDelegate>();
293-
gRvcCleanModeInstance = std::make_unique<ModeBase::Instance>(gRvcCleanModeDelegate.get(), endpointId, RvcCleanMode::Id,
294-
chip::to_underlying(RvcCleanMode::Feature::kNoFeatures));
293+
gRvcCleanModeInstance =
294+
std::make_unique<ModeBase::Instance>(gRvcCleanModeDelegate.get(), endpointId, RvcCleanMode::Id, 0 /* No feature bits */);
295295
gRvcCleanModeInstance->Init();
296296
}
297297
#endif // MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER

examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
}
1818
],
1919
"package": [
20-
{
21-
"pathRelativity": "relativeToZap",
22-
"path": "../../../src/app/zap-templates/app-templates.json",
23-
"type": "gen-templates-json",
24-
"category": "matter",
25-
"version": "chip-v1"
26-
},
2720
{
2821
"pathRelativity": "relativeToZap",
2922
"path": "../../../src/app/zap-templates/zcl/zcl.json",
3023
"type": "zcl-properties",
3124
"category": "matter",
3225
"version": 1,
3326
"description": "Matter SDK ZCL data"
27+
},
28+
{
29+
"pathRelativity": "relativeToZap",
30+
"path": "../../../src/app/zap-templates/app-templates.json",
31+
"type": "gen-templates-json",
32+
"category": "matter",
33+
"version": "chip-v1"
3434
}
3535
],
3636
"endpointTypes": [

examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter

+6-6
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ cluster GroupKeyManagement = 63 {
15841584

15851585
/** Attributes and commands for selecting a mode from a list of supported options. */
15861586
cluster RvcRunMode = 84 {
1587-
revision 2;
1587+
revision 3;
15881588

15891589
enum ModeTag : enum16 {
15901590
kIdle = 16384;
@@ -1604,7 +1604,7 @@ cluster RvcRunMode = 84 {
16041604
}
16051605

16061606
bitmap Feature : bitmap32 {
1607-
kNoFeatures = 0x0;
1607+
kDirectModeChange = 0x10000;
16081608
}
16091609

16101610
struct ModeTagStruct {
@@ -1643,7 +1643,7 @@ cluster RvcRunMode = 84 {
16431643

16441644
/** Attributes and commands for selecting a mode from a list of supported options. */
16451645
cluster RvcCleanMode = 85 {
1646-
revision 2;
1646+
revision 3;
16471647

16481648
enum ModeTag : enum16 {
16491649
kDeepClean = 16384;
@@ -1656,7 +1656,7 @@ cluster RvcCleanMode = 85 {
16561656
}
16571657

16581658
bitmap Feature : bitmap32 {
1659-
kNoFeatures = 0x0;
1659+
kDirectModeChange = 0x10000;
16601660
}
16611661

16621662
struct ModeTagStruct {
@@ -2010,7 +2010,7 @@ endpoint 1 {
20102010
callback attribute eventList;
20112011
callback attribute attributeList;
20122012
callback attribute featureMap;
2013-
ram attribute clusterRevision default = 2;
2013+
ram attribute clusterRevision default = 3;
20142014

20152015
handle command ChangeToMode;
20162016
handle command ChangeToModeResponse;
@@ -2024,7 +2024,7 @@ endpoint 1 {
20242024
callback attribute eventList;
20252025
callback attribute attributeList;
20262026
callback attribute featureMap;
2027-
ram attribute clusterRevision default = 2;
2027+
ram attribute clusterRevision default = 3;
20282028

20292029
handle command ChangeToMode;
20302030
handle command ChangeToModeResponse;

examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap

+2-2
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,7 @@
28522852
"storageOption": "RAM",
28532853
"singleton": 0,
28542854
"bounded": 0,
2855-
"defaultValue": "2",
2855+
"defaultValue": "3",
28562856
"reportable": 1,
28572857
"minInterval": 1,
28582858
"maxInterval": 65534,
@@ -3008,7 +3008,7 @@
30083008
"storageOption": "RAM",
30093009
"singleton": 0,
30103010
"bounded": 0,
3011-
"defaultValue": "2",
3011+
"defaultValue": "3",
30123012
"reportable": 1,
30133013
"minInterval": 1,
30143014
"maxInterval": 65534,

examples/rvc-app/rvc-common/rvc-app.matter

+6-6
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ cluster GroupKeyManagement = 63 {
12481248

12491249
/** Attributes and commands for selecting a mode from a list of supported options. */
12501250
cluster RvcRunMode = 84 {
1251-
revision 2;
1251+
revision 3;
12521252

12531253
enum ModeTag : enum16 {
12541254
kIdle = 16384;
@@ -1268,7 +1268,7 @@ cluster RvcRunMode = 84 {
12681268
}
12691269

12701270
bitmap Feature : bitmap32 {
1271-
kNoFeatures = 0x0;
1271+
kDirectModeChange = 0x10000;
12721272
}
12731273

12741274
struct ModeTagStruct {
@@ -1307,7 +1307,7 @@ cluster RvcRunMode = 84 {
13071307

13081308
/** Attributes and commands for selecting a mode from a list of supported options. */
13091309
cluster RvcCleanMode = 85 {
1310-
revision 2;
1310+
revision 3;
13111311

13121312
enum ModeTag : enum16 {
13131313
kDeepClean = 16384;
@@ -1320,7 +1320,7 @@ cluster RvcCleanMode = 85 {
13201320
}
13211321

13221322
bitmap Feature : bitmap32 {
1323-
kNoFeatures = 0x0;
1323+
kDirectModeChange = 0x10000;
13241324
}
13251325

13261326
struct ModeTagStruct {
@@ -1735,7 +1735,7 @@ endpoint 1 {
17351735
callback attribute eventList;
17361736
callback attribute attributeList;
17371737
callback attribute featureMap;
1738-
ram attribute clusterRevision default = 2;
1738+
ram attribute clusterRevision default = 3;
17391739

17401740
handle command ChangeToMode;
17411741
handle command ChangeToModeResponse;
@@ -1749,7 +1749,7 @@ endpoint 1 {
17491749
callback attribute eventList;
17501750
callback attribute attributeList;
17511751
callback attribute featureMap;
1752-
ram attribute clusterRevision default = 2;
1752+
ram attribute clusterRevision default = 3;
17531753

17541754
handle command ChangeToMode;
17551755
handle command ChangeToModeResponse;

examples/rvc-app/rvc-common/rvc-app.zap

+2-2
Original file line numberDiff line numberDiff line change
@@ -2478,7 +2478,7 @@
24782478
"storageOption": "RAM",
24792479
"singleton": 0,
24802480
"bounded": 0,
2481-
"defaultValue": "2",
2481+
"defaultValue": "3",
24822482
"reportable": 1,
24832483
"minInterval": 1,
24842484
"maxInterval": 65534,
@@ -2634,7 +2634,7 @@
26342634
"storageOption": "RAM",
26352635
"singleton": 0,
26362636
"bounded": 0,
2637-
"defaultValue": "2",
2637+
"defaultValue": "3",
26382638
"reportable": 1,
26392639
"minInterval": 1,
26402640
"maxInterval": 65534,

scripts/tools/zap/tests/inputs/all-clusters-app.zap

+2-2
Original file line numberDiff line numberDiff line change
@@ -9648,7 +9648,7 @@
96489648
"storageOption": "RAM",
96499649
"singleton": 0,
96509650
"bounded": 0,
9651-
"defaultValue": "2",
9651+
"defaultValue": "3",
96529652
"reportable": 1,
96539653
"minInterval": 1,
96549654
"maxInterval": 65534,
@@ -9804,7 +9804,7 @@
98049804
"storageOption": "RAM",
98059805
"singleton": 0,
98069806
"bounded": 0,
9807-
"defaultValue": "2",
9807+
"defaultValue": "3",
98089808
"reportable": 1,
98099809
"minInterval": 1,
98109810
"maxInterval": 65534,

scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -977,13 +977,13 @@
977977
{ ZAP_EMPTY_DEFAULT(), 0x00000000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* SupportedModes */ \
978978
{ ZAP_EMPTY_DEFAULT(), 0x00000001, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* CurrentMode */ \
979979
{ ZAP_EMPTY_DEFAULT(), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* FeatureMap */ \
980-
{ ZAP_SIMPLE_DEFAULT(2), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \
980+
{ ZAP_SIMPLE_DEFAULT(3), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \
981981
\
982982
/* Endpoint: 1, Cluster: RVC Clean Mode (server) */ \
983983
{ ZAP_EMPTY_DEFAULT(), 0x00000000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* SupportedModes */ \
984984
{ ZAP_EMPTY_DEFAULT(), 0x00000001, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* CurrentMode */ \
985985
{ ZAP_EMPTY_DEFAULT(), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* FeatureMap */ \
986-
{ ZAP_SIMPLE_DEFAULT(2), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \
986+
{ ZAP_SIMPLE_DEFAULT(3), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \
987987
\
988988
/* Endpoint: 1, Cluster: Temperature Control (server) */ \
989989
{ ZAP_SIMPLE_DEFAULT(0), 0x00000004, 1, ZAP_TYPE(INT8U), 0 }, /* SelectedTemperatureLevel */ \

0 commit comments

Comments
 (0)