Skip to content

Commit

Permalink
Align XML definitions for WebRTC Requester cluster with spec (#37650)
Browse files Browse the repository at this point in the history
* Align XML definations for WebRTC Requester cluster with spec

* Generate the xml from Alchemy
  • Loading branch information
yufengwangca authored Feb 20, 2025
1 parent d11e93b commit 616e1bd
Show file tree
Hide file tree
Showing 26 changed files with 184 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
#define MATTER_DM_CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_CAMERA_AV_SETTINGS_USER_LEVEL_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_WEBRTC_TRANSPORT_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_WEBRTC_TRANSPORT_REQUESTOR_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_WEB_RTC_TRANSPORT_REQUESTOR_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_PUSH_AV_STREAM_TRANSPORT_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_CHIME_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_ECOSYSTEM_INFORMATION_CLUSTER_SERVER_ENDPOINT_COUNT (0)
Expand Down Expand Up @@ -275,7 +275,7 @@
#define MATTER_DM_CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_CAMERA_AV_SETTINGS_USER_LEVEL_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_WEBRTC_TRANSPORT_PROVIDER_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_WEBRTC_TRANSPORT_REQUESTOR_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_WEB_RTC_TRANSPORT_REQUESTOR_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_PUSH_AV_STREAM_TRANSPORT_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_CHIME_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_ECOSYSTEM_INFORMATION_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
#define MATTER_DM_CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_CAMERA_AV_SETTINGS_USER_LEVEL_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_WEBRTC_TRANSPORT_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_WEBRTC_TRANSPORT_REQUESTOR_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_WEB_RTC_TRANSPORT_REQUESTOR_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_PUSH_AV_STREAM_TRANSPORT_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_CHIME_CLUSTER_SERVER_ENDPOINT_COUNT (0)
#define MATTER_DM_ECOSYSTEM_INFORMATION_CLUSTER_SERVER_ENDPOINT_COUNT (0)
Expand Down Expand Up @@ -275,7 +275,7 @@
#define MATTER_DM_CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_CAMERA_AV_SETTINGS_USER_LEVEL_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_WEBRTC_TRANSPORT_PROVIDER_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_WEBRTC_TRANSPORT_REQUESTOR_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_WEB_RTC_TRANSPORT_REQUESTOR_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_PUSH_AV_STREAM_TRANSPORT_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_CHIME_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
#define MATTER_DM_ECOSYSTEM_INFORMATION_CLUSTER_CLIENT_ENDPOINT_COUNT (0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2024 Project CHIP Authors
Copyright (c) 2025 Project CHIP Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -18,42 +18,46 @@ limitations under the License.
XML generated by Alchemy; DO NOT EDIT.
Source: src/app_clusters/WebRTC_Requestor.adoc
Parameters: in-progress
Git: 0.9-fall2024-228-g54b1ae035
Git: 0.7-summer-2025-5-g06c4d5596
-->
<configurator>
<domain name="CHIP"/>
<configurator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../zcl.xsd">
<domain name="Cameras"/>
<cluster apiMaturity="provisional">
<domain>Cameras</domain>
<name>WebRTC Transport Requestor</name>
<code>0x0554</code>
<define>WEBRTC_TRANSPORT_REQUESTOR_CLUSTER</define>
<define>WEB_RTC_TRANSPORT_REQUESTOR_CLUSTER</define>
<description>The WebRTC transport requestor cluster provides a way for stream consumers (e.g. Matter Stream Viewer) to establish a WebRTC connection with a stream provider.</description>
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<globalAttribute code="0xFFFD" side="either" value="1"/>
<attribute code="0x0000" side="server" define="CURRENT_SESSIONS" type="array" entryType="WebRTCSessionStruct" default="0">CurrentSessions</attribute>
<command code="0x01" source="client" name="Offer" optional="false">
<description>This command provides the stream requestor with WebRTC session details. It is sent following the receipt of a SolicitOffer command or a re-Offer initiated by the Provider.</description>
<description>This command provides the stream requestor with WebRTC session details.</description>
<quality largeMessage="true"/>
<arg id="1" name="WebRTCSessionID" type="int16u"/>
<arg id="2" name="SDP" type="char_string"/>
<arg id="3" name="ICEServers" array="true" type="ICEServerStruct" optional="true"/>
<arg id="4" name="ICETransportPolicy" type="char_string" optional="true"/>
</command>

<command code="0x02" source="client" name="Answer" optional="false">
<description>This command provides the stream requestor with the WebRTC session details (i.e. Session ID and SDP answer). It is the next command in the Offer/Answer flow to the ProvideOffer command.</description>
<description>This command provides the stream requestor with the WebRTC session details (i.e. Session ID and SDP answer), It is the next command in the Offer/Answer flow to the ProvideOffer command.</description>
<quality largeMessage="true"/>
<arg id="1" name="WebRTCSessionID" type="int16u"/>
<arg id="2" name="SDP" type="char_string"/>
</command>

<command code="0x03" source="client" name="ICECandidate" optional="false">
<description>This command provides an ICE candidate to the stream requestor in a WebRTC session.</description>
<command code="0x03" source="client" name="ICECandidates" optional="false">
<description>This command allows for string based https://rfc-editor.org/rfc/rfc8839#section-5.1 generated after the initial Offer / Answer exchange, via a JSEP https://datatracker.ietf.org/doc/html/rfc9429#section-4.1.20 event, a DOM https://www.w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent event, or other WebRTC compliant implementations, to be added to a session during the gathering phase.</description>
<quality largeMessage="true"/>
<arg id="1" name="WebRTCSessionID" type="int16u"/>
<arg id="2" name="ICECandidate" type="char_string"/>
<arg id="2" name="ICECandidates" array="true" type="char_string" minLength="1"/>
</command>

<command code="0x04" source="client" name="End" optional="false">
<description>This command notifies the stream requestor that the provider has ended the WebRTC session.</description>
<quality largeMessage="true"/>
<arg id="1" name="WebRTCSessionID" type="int16u"/>
<arg id="2" name="Reason" type="WebRTCEndReasonEnum" min="0x00" max="0x0B"/>
</command>
Expand Down
12 changes: 6 additions & 6 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -10260,22 +10260,22 @@ provisional cluster WebRTCTransportRequestor = 1364 {
char_string sdp = 1;
}

request struct ICECandidateRequest {
request struct ICECandidatesRequest {
int16u webRTCSessionID = 0;
char_string ICECandidate = 1;
char_string ICECandidates[] = 1;
}

request struct EndRequest {
int16u webRTCSessionID = 0;
WebRTCEndReasonEnum reason = 1;
}

/** This command provides the stream requestor with WebRTC session details. It is sent following the receipt of a SolicitOffer command or a re-Offer initiated by the Provider. */
/** This command provides the stream requestor with WebRTC session details. */
command Offer(OfferRequest): DefaultSuccess = 1;
/** This command provides the stream requestor with the WebRTC session details (i.e. Session ID and SDP answer). It is the next command in the Offer/Answer flow to the ProvideOffer command. */
/** This command provides the stream requestor with the WebRTC session details (i.e. Session ID and SDP answer), It is the next command in the Offer/Answer flow to the ProvideOffer command. */
command Answer(AnswerRequest): DefaultSuccess = 2;
/** This command provides an ICE candidate to the stream requestor in a WebRTC session. */
command ICECandidate(ICECandidateRequest): DefaultSuccess = 3;
/** This command allows for string based https://rfc-editor.org/rfc/rfc8839#section-5.1 generated after the initial Offer / Answer exchange, via a JSEP https://datatracker.ietf.org/doc/html/rfc9429#section-4.1.20 event, a DOM https://www.w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent event, or other WebRTC compliant implementations, to be added to a session during the gathering phase. */
command ICECandidates(ICECandidatesRequest): DefaultSuccess = 3;
/** This command notifies the stream requestor that the provider has ended the WebRTC session. */
command End(EndRequest): DefaultSuccess = 4;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63316,21 +63316,21 @@ public void onResponse(StructType invokeStructValue) {
}}, commandId, commandArgs, timedInvokeTimeoutMs);
}

public void ICECandidate(DefaultClusterCallback callback, Integer webRTCSessionID, String ICECandidate) {
ICECandidate(callback, webRTCSessionID, ICECandidate, 0);
public void ICECandidates(DefaultClusterCallback callback, Integer webRTCSessionID, ArrayList<String> ICECandidates) {
ICECandidates(callback, webRTCSessionID, ICECandidates, 0);
}

public void ICECandidate(DefaultClusterCallback callback, Integer webRTCSessionID, String ICECandidate, int timedInvokeTimeoutMs) {
public void ICECandidates(DefaultClusterCallback callback, Integer webRTCSessionID, ArrayList<String> ICECandidates, int timedInvokeTimeoutMs) {
final long commandId = 3L;

ArrayList<StructElement> elements = new ArrayList<>();
final long webRTCSessionIDFieldID = 0L;
BaseTLVType webRTCSessionIDtlvValue = new UIntType(webRTCSessionID);
elements.add(new StructElement(webRTCSessionIDFieldID, webRTCSessionIDtlvValue));

final long ICECandidateFieldID = 1L;
BaseTLVType ICECandidatetlvValue = new StringType(ICECandidate);
elements.add(new StructElement(ICECandidateFieldID, ICECandidatetlvValue));
final long ICECandidatesFieldID = 1L;
BaseTLVType ICECandidatestlvValue = ArrayType.generateArrayType(ICECandidates, (elementICECandidates) -> new StringType(elementICECandidates));
elements.add(new StructElement(ICECandidatesFieldID, ICECandidatestlvValue));

StructType commandArgs = new StructType(elements);
invoke(new InvokeCallbackImpl(callback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18015,7 +18015,7 @@ public static Event value(long id) throws NoSuchFieldError {
public enum Command {
Offer(1L),
Answer(2L),
ICECandidate(3L),
ICECandidates(3L),
End(4L),;
private final long id;
Command(long id) {
Expand Down Expand Up @@ -18068,17 +18068,17 @@ public static AnswerCommandField value(int id) throws NoSuchFieldError {
}
throw new NoSuchFieldError();
}
}public enum ICECandidateCommandField {WebRTCSessionID(0),ICECandidate(1),;
}public enum ICECandidatesCommandField {WebRTCSessionID(0),ICECandidates(1),;
private final int id;
ICECandidateCommandField(int id) {
ICECandidatesCommandField(int id) {
this.id = id;
}

public int getID() {
return id;
}
public static ICECandidateCommandField value(int id) throws NoSuchFieldError {
for (ICECandidateCommandField field : ICECandidateCommandField.values()) {
public static ICECandidatesCommandField value(int id) throws NoSuchFieldError {
for (ICECandidatesCommandField field : ICECandidatesCommandField.values()) {
if (field.getID() == id) {
return field;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31132,27 +31132,27 @@ public Map<String, Map<String, InteractionInfo>> getCommandMap() {
);
webRTCTransportRequestorClusterInteractionInfoMap.put("answer", webRTCTransportRequestoranswerInteractionInfo);

Map<String, CommandParameterInfo> webRTCTransportRequestorICECandidateCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
Map<String, CommandParameterInfo> webRTCTransportRequestorICECandidatesCommandParams = new LinkedHashMap<String, CommandParameterInfo>();

CommandParameterInfo webRTCTransportRequestorICECandidatewebRTCSessionIDCommandParameterInfo = new CommandParameterInfo("webRTCSessionID", Integer.class, Integer.class);
webRTCTransportRequestorICECandidateCommandParams.put("webRTCSessionID",webRTCTransportRequestorICECandidatewebRTCSessionIDCommandParameterInfo);
CommandParameterInfo webRTCTransportRequestorICECandidateswebRTCSessionIDCommandParameterInfo = new CommandParameterInfo("webRTCSessionID", Integer.class, Integer.class);
webRTCTransportRequestorICECandidatesCommandParams.put("webRTCSessionID",webRTCTransportRequestorICECandidateswebRTCSessionIDCommandParameterInfo);

CommandParameterInfo webRTCTransportRequestorICECandidateICECandidateCommandParameterInfo = new CommandParameterInfo("ICECandidate", String.class, String.class);
webRTCTransportRequestorICECandidateCommandParams.put("ICECandidate",webRTCTransportRequestorICECandidateICECandidateCommandParameterInfo);
InteractionInfo webRTCTransportRequestorICECandidateInteractionInfo = new InteractionInfo(
CommandParameterInfo webRTCTransportRequestorICECandidatesICECandidatesCommandParameterInfo = new CommandParameterInfo("ICECandidates", ArrayList.class, ArrayList.class);
webRTCTransportRequestorICECandidatesCommandParams.put("ICECandidates",webRTCTransportRequestorICECandidatesICECandidatesCommandParameterInfo);
InteractionInfo webRTCTransportRequestorICECandidatesInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.WebRTCTransportRequestorCluster) cluster)
.ICECandidate((DefaultClusterCallback) callback
.ICECandidates((DefaultClusterCallback) callback
, (Integer)
commandArguments.get("webRTCSessionID")
, (String)
commandArguments.get("ICECandidate")
, (ArrayList<String>)
commandArguments.get("ICECandidates")
);
},
() -> new DelegatedDefaultClusterCallback(),
webRTCTransportRequestorICECandidateCommandParams
webRTCTransportRequestorICECandidatesCommandParams
);
webRTCTransportRequestorClusterInteractionInfoMap.put("ICECandidate", webRTCTransportRequestorICECandidateInteractionInfo);
webRTCTransportRequestorClusterInteractionInfoMap.put("ICECandidates", webRTCTransportRequestorICECandidatesInteractionInfo);

Map<String, CommandParameterInfo> webRTCTransportRequestorendCommandParams = new LinkedHashMap<String, CommandParameterInfo>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ class WebRTCTransportRequestorCluster(
logger.log(Level.FINE, "Invoke command succeeded: ${response}")
}

suspend fun ICECandidate(
suspend fun ICECandidates(
webRTCSessionID: UShort,
ICECandidate: String,
ICECandidates: List<String>,
timedInvokeTimeout: Duration? = null,
) {
val commandId: UInt = 3u
Expand All @@ -177,8 +177,12 @@ class WebRTCTransportRequestorCluster(
val TAG_WEB_RTC_SESSION_ID_REQ: Int = 0
tlvWriter.put(ContextSpecificTag(TAG_WEB_RTC_SESSION_ID_REQ), webRTCSessionID)

val TAG_ICE_CANDIDATE_REQ: Int = 1
tlvWriter.put(ContextSpecificTag(TAG_ICE_CANDIDATE_REQ), ICECandidate)
val TAG_ICE_CANDIDATES_REQ: Int = 1
tlvWriter.startArray(ContextSpecificTag(TAG_ICE_CANDIDATES_REQ))
for (item in ICECandidates.iterator()) {
tlvWriter.put(AnonymousTag, item)
}
tlvWriter.endArray()
tlvWriter.endStructure()

val request: InvokeRequest =
Expand Down
4 changes: 2 additions & 2 deletions src/controller/python/chip/clusters/CHIPClusters.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/controller/python/chip/clusters/Objects.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 616e1bd

Please sign in to comment.