Skip to content

Commit 942db8e

Browse files
Adds the RVC Operational State cluster's GoHome command (project-chip#31242)
* Added the RvcOpearationalState specific command GoHome to the XML. * Regenerated files from XMLs. * Regenerated files from XMLs after merging changes in master. * Regenerated zap files. * Added missing license to an all-clusters-app src file. * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 603f1f6 commit 942db8e

File tree

25 files changed

+460
-1
lines changed

25 files changed

+460
-1
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -3420,6 +3420,8 @@ cluster RvcOperationalState = 97 {
34203420
command Start(): OperationalCommandResponse = 2;
34213421
/** Upon receipt, the device SHALL resume its operation from the point it was at when it received the Pause command, or from the point when it was paused by means outside of this cluster (for example by manual button press). */
34223422
command Resume(): OperationalCommandResponse = 3;
3423+
/** On receipt of this command, the device SHALL start seeking the charging dock, if possible in the current state of the device. */
3424+
command GoHome(): OperationalCommandResponse = 128;
34233425
}
34243426

34253427
/** Attributes and commands for scene configuration and manipulation. */

examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
#include <air-quality-instance.h>
219

320
using namespace chip::app::Clusters;

examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter

+2
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,8 @@ cluster RvcOperationalState = 97 {
11781178
command Start(): OperationalCommandResponse = 2;
11791179
/** Upon receipt, the device SHALL resume its operation from the point it was at when it received the Pause command, or from the point when it was paused by means outside of this cluster (for example by manual button press). */
11801180
command Resume(): OperationalCommandResponse = 3;
1181+
/** On receipt of this command, the device SHALL start seeking the charging dock, if possible in the current state of the device. */
1182+
command GoHome(): OperationalCommandResponse = 128;
11811183
}
11821184

11831185
endpoint 0 {

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

+2
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,8 @@ cluster RvcOperationalState = 97 {
11011101
command Start(): OperationalCommandResponse = 2;
11021102
/** Upon receipt, the device SHALL resume its operation from the point it was at when it received the Pause command, or from the point when it was paused by means outside of this cluster (for example by manual button press). */
11031103
command Resume(): OperationalCommandResponse = 3;
1104+
/** On receipt of this command, the device SHALL start seeking the charging dock, if possible in the current state of the device. */
1105+
command GoHome(): OperationalCommandResponse = 128;
11041106
}
11051107

11061108
endpoint 0 {

src/app/zap-templates/zcl/data-model/chip/operational-state-rvc-cluster.xml

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ both values from this cluster and from the base cluster.
8181
<arg name="CommandResponseState" type="ErrorStateStruct"/>
8282
</command>
8383

84+
<command source="client" code="0x80" name="GoHome" response="OperationalCommandResponse" optional="true">
85+
<description>On receipt of this command, the device SHALL start seeking the charging dock, if possible in the current state of the device.</description>
86+
</command>
87+
8488
<event side="server" code="0x00" priority="critical" name="OperationalError" optional="false">
8589
<description>OperationalError</description>
8690
<field id="0" name="ErrorState" type="ErrorStateStruct" />

src/controller/data_model/controller-clusters.matter

+2
Original file line numberDiff line numberDiff line change
@@ -3721,6 +3721,8 @@ cluster RvcOperationalState = 97 {
37213721
command Start(): OperationalCommandResponse = 2;
37223722
/** Upon receipt, the device SHALL resume its operation from the point it was at when it received the Pause command, or from the point when it was paused by means outside of this cluster (for example by manual button press). */
37233723
command Resume(): OperationalCommandResponse = 3;
3724+
/** On receipt of this command, the device SHALL start seeking the charging dock, if possible in the current state of the device. */
3725+
command GoHome(): OperationalCommandResponse = 128;
37243726
}
37253727

37263728
/** Attributes and commands for scene configuration and manipulation. */

src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java

+26
Original file line numberDiff line numberDiff line change
@@ -25491,6 +25491,32 @@ public void onResponse(StructType invokeStructValue) {
2549125491
}}, commandId, value, timedInvokeTimeoutMs);
2549225492
}
2549325493

25494+
public void goHome(OperationalCommandResponseCallback callback) {
25495+
goHome(callback, 0);
25496+
}
25497+
25498+
public void goHome(OperationalCommandResponseCallback callback, int timedInvokeTimeoutMs) {
25499+
final long commandId = 128L;
25500+
25501+
ArrayList<StructElement> elements = new ArrayList<>();
25502+
StructType value = new StructType(elements);
25503+
invoke(new InvokeCallbackImpl(callback) {
25504+
@Override
25505+
public void onResponse(StructType invokeStructValue) {
25506+
final long commandResponseStateFieldID = 0L;
25507+
ChipStructs.RvcOperationalStateClusterErrorStateStruct commandResponseState = null;
25508+
for (StructElement element: invokeStructValue.value()) {
25509+
if (element.contextTagNum() == commandResponseStateFieldID) {
25510+
if (element.value(BaseTLVType.class).type() == TLVType.Struct) {
25511+
StructType castingValue = element.value(StructType.class);
25512+
commandResponseState = ChipStructs.RvcOperationalStateClusterErrorStateStruct.decodeTlv(castingValue);
25513+
}
25514+
}
25515+
}
25516+
callback.onSuccess(commandResponseState);
25517+
}}, commandId, value, timedInvokeTimeoutMs);
25518+
}
25519+
2549425520
public interface OperationalCommandResponseCallback extends BaseClusterCallback {
2549525521
void onSuccess(ChipStructs.RvcOperationalStateClusterErrorStateStruct commandResponseState);
2549625522
}

src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -8227,7 +8227,8 @@ public enum Command {
82278227
Pause(0L),
82288228
Stop(1L),
82298229
Start(2L),
8230-
Resume(3L),;
8230+
Resume(3L),
8231+
GoHome(128L),;
82318232
private final long id;
82328233
Command(long id) {
82338234
this.id = id;

src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java

+12
Original file line numberDiff line numberDiff line change
@@ -22843,6 +22843,18 @@ public Map<String, Map<String, InteractionInfo>> getCommandMap() {
2284322843
);
2284422844
rvcOperationalStateClusterInteractionInfoMap.put("resume", rvcOperationalStateresumeInteractionInfo);
2284522845

22846+
Map<String, CommandParameterInfo> rvcOperationalStategoHomeCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
22847+
InteractionInfo rvcOperationalStategoHomeInteractionInfo = new InteractionInfo(
22848+
(cluster, callback, commandArguments) -> {
22849+
((ChipClusters.RvcOperationalStateCluster) cluster)
22850+
.goHome((ChipClusters.RvcOperationalStateCluster.OperationalCommandResponseCallback) callback
22851+
);
22852+
},
22853+
() -> new DelegatedRvcOperationalStateClusterOperationalCommandResponseCallback(),
22854+
rvcOperationalStategoHomeCommandParams
22855+
);
22856+
rvcOperationalStateClusterInteractionInfoMap.put("goHome", rvcOperationalStategoHomeInteractionInfo);
22857+
2284622858
commandMap.put("rvcOperationalState", rvcOperationalStateClusterInteractionInfoMap);
2284722859

2284822860
Map<String, InteractionInfo> scenesManagementClusterInteractionInfoMap = new LinkedHashMap<>();

src/controller/java/generated/java/matter/controller/cluster/clusters/RvcOperationalStateCluster.kt

+42
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,48 @@ class RvcOperationalStateCluster(
310310
return OperationalCommandResponse(commandResponseState_decoded)
311311
}
312312

313+
suspend fun goHome(timedInvokeTimeout: Duration? = null): OperationalCommandResponse {
314+
val commandId: UInt = 128u
315+
316+
val tlvWriter = TlvWriter()
317+
tlvWriter.startStructure(AnonymousTag)
318+
tlvWriter.endStructure()
319+
320+
val request: InvokeRequest =
321+
InvokeRequest(
322+
CommandPath(endpointId, clusterId = CLUSTER_ID, commandId),
323+
tlvPayload = tlvWriter.getEncoded(),
324+
timedRequest = timedInvokeTimeout
325+
)
326+
327+
val response: InvokeResponse = controller.invoke(request)
328+
logger.log(Level.FINE, "Invoke command succeeded: ${response}")
329+
330+
val tlvReader = TlvReader(response.payload)
331+
tlvReader.enterStructure(AnonymousTag)
332+
val TAG_COMMAND_RESPONSE_STATE: Int = 0
333+
var commandResponseState_decoded: RvcOperationalStateClusterErrorStateStruct? = null
334+
335+
while (!tlvReader.isEndOfContainer()) {
336+
val tag = tlvReader.peekElement().tag
337+
338+
if (tag == ContextSpecificTag(TAG_COMMAND_RESPONSE_STATE)) {
339+
commandResponseState_decoded =
340+
RvcOperationalStateClusterErrorStateStruct.fromTlv(tag, tlvReader)
341+
} else {
342+
tlvReader.skipElement()
343+
}
344+
}
345+
346+
if (commandResponseState_decoded == null) {
347+
throw IllegalStateException("commandResponseState not found in TLV")
348+
}
349+
350+
tlvReader.exitContainer()
351+
352+
return OperationalCommandResponse(commandResponseState_decoded)
353+
}
354+
313355
suspend fun readPhaseListAttribute(): PhaseListAttribute {
314356
val ATTRIBUTE_ID: UInt = 0u
315357

src/controller/python/chip/clusters/CHIPClusters.py

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controller/python/chip/clusters/Objects.py

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRClusters.h

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm

+31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)