Skip to content

Commit 8d10292

Browse files
committed
Align xml defination for WebRTC provider cluster with spec
1 parent 33aec35 commit 8d10292

File tree

25 files changed

+251
-177
lines changed

25 files changed

+251
-177
lines changed

src/app/zap-templates/zcl/data-model/chip/webrtc-provider-cluster.xml

+12-13
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ Parameters: in-progress
2121
Git: 0.9-fall2024-234-gf4d359001
2222
-->
2323
<configurator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../zcl.xsd">
24-
<domain name="General"/>
25-
26-
<bitmap name="WebRTCMetadataOptions" type="bitmap8">
24+
<domain name="Cameras"/>
25+
<bitmap name="WebRTCMetadataOptionsBitmap" type="bitmap8">
2726
<cluster code="0x0553"/>
2827
<cluster code="0x0554"/>
2928
<field name="DataTLV" mask="0x01"/>
@@ -64,11 +63,11 @@ Git: 0.9-fall2024-234-gf4d359001
6463
<item fieldId="4" name="StreamUsage" type="StreamUsageEnum" min="0x00" max="0x03"/>
6564
<item fieldId="5" name="VideoStreamID" type="int16u" isNullable="true"/>
6665
<item fieldId="6" name="AudioStreamID" type="int16u" isNullable="true"/>
67-
<item fieldId="7" name="MetadataOptions" type="WebRTCMetadataOptions" default="0x00" min="0x00" max="0x01"/>
66+
<item fieldId="7" name="MetadataOptions" type="WebRTCMetadataOptionsBitmap" default="0x00" min="0x00" max="0x01"/>
6867
</struct>
6968

7069
<cluster apiMaturity="provisional">
71-
<domain name="Cameras"/>
70+
<domain>Cameras</domain>
7271
<name>WebRTC Transport Provider</name>
7372
<code>0x0553</code>
7473
<define>WEBRTC_TRANSPORT_PROVIDER_CLUSTER</define>
@@ -84,7 +83,7 @@ Git: 0.9-fall2024-234-gf4d359001
8483
<arg id="3" name="AudioStreamID" type="int16u" optional="true" isNullable="true"/>
8584
<arg id="4" name="ICEServers" array="true" type="ICEServerStruct" optional="true"/>
8685
<arg id="5" name="ICETransportPolicy" type="char_string" optional="true"/>
87-
<arg id="6" name="MetadataOptions" type="WebRTCMetadataOptions" optional="true" min="0x00" max="0x01"/>
86+
<arg id="6" name="MetadataOptions" type="WebRTCMetadataOptionsBitmap" optional="true" min="0x00" max="0x01"/>
8887
</command>
8988

9089
<command code="0x02" source="server" name="SolicitOfferResponse" optional="false" disableDefaultResponse="true">
@@ -104,14 +103,14 @@ Git: 0.9-fall2024-234-gf4d359001
104103
<arg id="5" name="AudioStreamID" type="int16u" optional="true" isNullable="true"/>
105104
<arg id="6" name="ICEServers" array="true" type="ICEServerStruct" optional="true"/>
106105
<arg id="7" name="ICETransportPolicy" type="char_string" optional="true"/>
107-
<arg id="8" name="MetadataOptions" type="WebRTCMetadataOptions" optional="true" min="0x00" max="0x01"/>
106+
<arg id="8" name="MetadataOptions" type="WebRTCMetadataOptionsBitmap" optional="true" min="0x00" max="0x01"/>
108107
</command>
109108

110109
<command code="0x04" source="server" name="ProvideOfferResponse" optional="false" disableDefaultResponse="true">
111-
<description>This command contains information about the stream created as a response to the requestor&apos;s offer.</description>
110+
<description>This command contains information about the session and streams created as a response to the requestor&apos;s offer.</description>
112111
<arg id="1" name="WebRTCSessionID" type="int16u"/>
113-
<arg id="2" name="VideoStreamID" type="int16u"/>
114-
<arg id="3" name="AudioStreamID" type="int16u"/>
112+
<arg id="2" name="VideoStreamID" type="int16u" optional="true" isNullable="true"/>
113+
<arg id="3" name="AudioStreamID" type="int16u" optional="true" isNullable="true"/>
115114
</command>
116115

117116
<command code="0x05" source="client" name="ProvideAnswer" optional="false">
@@ -120,10 +119,10 @@ Git: 0.9-fall2024-234-gf4d359001
120119
<arg id="2" name="SDP" type="char_string"/>
121120
</command>
122121

123-
<command code="0x06" source="client" name="ProvideICECandidate" optional="false">
124-
<description>This command allows for https://www.rfc-editor.org/rfc/rfc8839#section-4.2.1.2 nominated after the initial Offer / Answer exchange to be added to a session during the gathering phase.</description>
122+
<command code="0x06" source="client" name="ProvideICECandidates" optional="false">
123+
<description>This command allows for https://rfc-editor.org/rfc/rfc8839#section-5.1 generated after the initial Offer / Answer exchange to be added to a session during the gathering phase.</description>
125124
<arg id="1" name="WebRTCSessionID" type="int16u"/>
126-
<arg id="2" name="ICECandidate" type="char_string"/>
125+
<arg id="2" name="ICECandidates" array="true" type="char_string" minLength="1"/>
127126
</command>
128127

129128
<command code="0x07" source="client" name="EndSession" optional="false">

src/controller/data_model/controller-clusters.matter

+12-12
Original file line numberDiff line numberDiff line change
@@ -10104,7 +10104,7 @@ provisional cluster WebRTCTransportProvider = 1363 {
1010410104
kUnknownReason = 11;
1010510105
}
1010610106

10107-
bitmap WebRTCMetadataOptions : bitmap8 {
10107+
bitmap WebRTCMetadataOptionsBitmap : bitmap8 {
1010810108
kDataTLV = 0x1;
1010910109
}
1011010110

@@ -10122,7 +10122,7 @@ provisional cluster WebRTCTransportProvider = 1363 {
1012210122
StreamUsageEnum streamUsage = 4;
1012310123
nullable int16u videoStreamID = 5;
1012410124
nullable int16u audioStreamID = 6;
10125-
WebRTCMetadataOptions metadataOptions = 7;
10125+
WebRTCMetadataOptionsBitmap metadataOptions = 7;
1012610126
}
1012710127

1012810128
readonly attribute WebRTCSessionStruct currentSessions[] = 0;
@@ -10139,7 +10139,7 @@ provisional cluster WebRTCTransportProvider = 1363 {
1013910139
optional nullable int16u audioStreamID = 2;
1014010140
optional ICEServerStruct ICEServers[] = 3;
1014110141
optional char_string ICETransportPolicy = 4;
10142-
optional WebRTCMetadataOptions metadataOptions = 5;
10142+
optional WebRTCMetadataOptionsBitmap metadataOptions = 5;
1014310143
}
1014410144

1014510145
response struct SolicitOfferResponse = 2 {
@@ -10157,23 +10157,23 @@ provisional cluster WebRTCTransportProvider = 1363 {
1015710157
optional nullable int16u audioStreamID = 4;
1015810158
optional ICEServerStruct ICEServers[] = 5;
1015910159
optional char_string ICETransportPolicy = 6;
10160-
optional WebRTCMetadataOptions metadataOptions = 7;
10160+
optional WebRTCMetadataOptionsBitmap metadataOptions = 7;
1016110161
}
1016210162

1016310163
response struct ProvideOfferResponse = 4 {
1016410164
int16u webRTCSessionID = 0;
10165-
int16u videoStreamID = 1;
10166-
int16u audioStreamID = 2;
10165+
optional nullable int16u videoStreamID = 1;
10166+
optional nullable int16u audioStreamID = 2;
1016710167
}
1016810168

1016910169
request struct ProvideAnswerRequest {
1017010170
int16u webRTCSessionID = 0;
1017110171
char_string sdp = 1;
1017210172
}
1017310173

10174-
request struct ProvideICECandidateRequest {
10174+
request struct ProvideICECandidatesRequest {
1017510175
int16u webRTCSessionID = 0;
10176-
char_string ICECandidate = 1;
10176+
char_string ICECandidates[] = 1;
1017710177
}
1017810178

1017910179
request struct EndSessionRequest {
@@ -10187,8 +10187,8 @@ provisional cluster WebRTCTransportProvider = 1363 {
1018710187
command ProvideOffer(ProvideOfferRequest): ProvideOfferResponse = 3;
1018810188
/** This command SHALL be initiated from a Node in response to an Offer that was previously received from a remote peer. */
1018910189
command ProvideAnswer(ProvideAnswerRequest): DefaultSuccess = 5;
10190-
/** This command allows for https://www.rfc-editor.org/rfc/rfc8839#section-4.2.1.2 nominated after the initial Offer / Answer exchange to be added to a session during the gathering phase. */
10191-
command ProvideICECandidate(ProvideICECandidateRequest): DefaultSuccess = 6;
10190+
/** This command allows for https://rfc-editor.org/rfc/rfc8839#section-5.1 generated after the initial Offer / Answer exchange to be added to a session during the gathering phase. */
10191+
command ProvideICECandidates(ProvideICECandidatesRequest): DefaultSuccess = 6;
1019210192
/** This command instructs the stream provider to end the WebRTC session. */
1019310193
command EndSession(EndSessionRequest): DefaultSuccess = 7;
1019410194
}
@@ -10219,7 +10219,7 @@ provisional cluster WebRTCTransportRequestor = 1364 {
1021910219
kUnknownReason = 11;
1022010220
}
1022110221

10222-
bitmap WebRTCMetadataOptions : bitmap8 {
10222+
bitmap WebRTCMetadataOptionsBitmap : bitmap8 {
1022310223
kDataTLV = 0x1;
1022410224
}
1022510225

@@ -10237,7 +10237,7 @@ provisional cluster WebRTCTransportRequestor = 1364 {
1023710237
StreamUsageEnum streamUsage = 4;
1023810238
nullable int16u videoStreamID = 5;
1023910239
nullable int16u audioStreamID = 6;
10240-
WebRTCMetadataOptions metadataOptions = 7;
10240+
WebRTCMetadataOptionsBitmap metadataOptions = 7;
1024110241
}
1024210242

1024310243
readonly attribute WebRTCSessionStruct currentSessions[] = 0;

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -62931,9 +62931,9 @@ public void onResponse(StructType invokeStructValue) {
6293162931
final long webRTCSessionIDFieldID = 0L;
6293262932
Integer webRTCSessionID = null;
6293362933
final long videoStreamIDFieldID = 1L;
62934-
Integer videoStreamID = null;
62934+
@Nullable Optional<Integer> videoStreamID = null;
6293562935
final long audioStreamIDFieldID = 2L;
62936-
Integer audioStreamID = null;
62936+
@Nullable Optional<Integer> audioStreamID = null;
6293762937
for (StructElement element: invokeStructValue.value()) {
6293862938
if (element.contextTagNum() == webRTCSessionIDFieldID) {
6293962939
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
@@ -62943,12 +62943,12 @@ public void onResponse(StructType invokeStructValue) {
6294362943
} else if (element.contextTagNum() == videoStreamIDFieldID) {
6294462944
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
6294562945
UIntType castingValue = element.value(UIntType.class);
62946-
videoStreamID = castingValue.value(Integer.class);
62946+
videoStreamID = Optional.of(castingValue.value(Integer.class));
6294762947
}
6294862948
} else if (element.contextTagNum() == audioStreamIDFieldID) {
6294962949
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
6295062950
UIntType castingValue = element.value(UIntType.class);
62951-
audioStreamID = castingValue.value(Integer.class);
62951+
audioStreamID = Optional.of(castingValue.value(Integer.class));
6295262952
}
6295362953
}
6295462954
}
@@ -62980,21 +62980,21 @@ public void onResponse(StructType invokeStructValue) {
6298062980
}}, commandId, commandArgs, timedInvokeTimeoutMs);
6298162981
}
6298262982

62983-
public void provideICECandidate(DefaultClusterCallback callback, Integer webRTCSessionID, String ICECandidate) {
62984-
provideICECandidate(callback, webRTCSessionID, ICECandidate, 0);
62983+
public void provideICECandidates(DefaultClusterCallback callback, Integer webRTCSessionID, ArrayList<String> ICECandidates) {
62984+
provideICECandidates(callback, webRTCSessionID, ICECandidates, 0);
6298562985
}
6298662986

62987-
public void provideICECandidate(DefaultClusterCallback callback, Integer webRTCSessionID, String ICECandidate, int timedInvokeTimeoutMs) {
62987+
public void provideICECandidates(DefaultClusterCallback callback, Integer webRTCSessionID, ArrayList<String> ICECandidates, int timedInvokeTimeoutMs) {
6298862988
final long commandId = 6L;
6298962989

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

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

6299962999
StructType commandArgs = new StructType(elements);
6300063000
invoke(new InvokeCallbackImpl(callback) {
@@ -63033,7 +63033,7 @@ public interface SolicitOfferResponseCallback extends BaseClusterCallback {
6303363033
}
6303463034

6303563035
public interface ProvideOfferResponseCallback extends BaseClusterCallback {
63036-
void onSuccess(Integer webRTCSessionID, Integer videoStreamID, Integer audioStreamID);
63036+
void onSuccess(Integer webRTCSessionID, @Nullable Optional<Integer> videoStreamID, @Nullable Optional<Integer> audioStreamID);
6303763037
}
6303863038

6303963039
public interface CurrentSessionsAttributeCallback extends BaseAttributeCallback {

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -17825,7 +17825,7 @@ public enum Command {
1782517825
SolicitOffer(1L),
1782617826
ProvideOffer(3L),
1782717827
ProvideAnswer(5L),
17828-
ProvideICECandidate(6L),
17828+
ProvideICECandidates(6L),
1782917829
EndSession(7L),;
1783017830
private final long id;
1783117831
Command(long id) {
@@ -17895,17 +17895,17 @@ public static ProvideAnswerCommandField value(int id) throws NoSuchFieldError {
1789517895
}
1789617896
throw new NoSuchFieldError();
1789717897
}
17898-
}public enum ProvideICECandidateCommandField {WebRTCSessionID(0),ICECandidate(1),;
17898+
}public enum ProvideICECandidatesCommandField {WebRTCSessionID(0),ICECandidates(1),;
1789917899
private final int id;
17900-
ProvideICECandidateCommandField(int id) {
17900+
ProvideICECandidatesCommandField(int id) {
1790117901
this.id = id;
1790217902
}
1790317903

1790417904
public int getID() {
1790517905
return id;
1790617906
}
17907-
public static ProvideICECandidateCommandField value(int id) throws NoSuchFieldError {
17908-
for (ProvideICECandidateCommandField field : ProvideICECandidateCommandField.values()) {
17907+
public static ProvideICECandidatesCommandField value(int id) throws NoSuchFieldError {
17908+
for (ProvideICECandidatesCommandField field : ProvideICECandidatesCommandField.values()) {
1790917909
if (field.getID() == id) {
1791017910
return field;
1791117911
}

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

+14-14
Original file line numberDiff line numberDiff line change
@@ -20861,14 +20861,14 @@ public void setCallbackDelegate(ClusterCommandCallback callback) {
2086120861
}
2086220862

2086320863
@Override
20864-
public void onSuccess(Integer webRTCSessionID, Integer videoStreamID, Integer audioStreamID) {
20864+
public void onSuccess(Integer webRTCSessionID, @Nullable Optional<Integer> videoStreamID, @Nullable Optional<Integer> audioStreamID) {
2086520865
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
2086620866

2086720867
CommandResponseInfo webRTCSessionIDResponseValue = new CommandResponseInfo("webRTCSessionID", "Integer");
2086820868
responseValues.put(webRTCSessionIDResponseValue, webRTCSessionID);
20869-
CommandResponseInfo videoStreamIDResponseValue = new CommandResponseInfo("videoStreamID", "Integer");
20869+
CommandResponseInfo videoStreamIDResponseValue = new CommandResponseInfo("videoStreamID", "Optional<Integer>");
2087020870
responseValues.put(videoStreamIDResponseValue, videoStreamID);
20871-
CommandResponseInfo audioStreamIDResponseValue = new CommandResponseInfo("audioStreamID", "Integer");
20871+
CommandResponseInfo audioStreamIDResponseValue = new CommandResponseInfo("audioStreamID", "Optional<Integer>");
2087220872
responseValues.put(audioStreamIDResponseValue, audioStreamID);
2087320873
callback.onSuccess(responseValues);
2087420874
}
@@ -31032,27 +31032,27 @@ public Map<String, Map<String, InteractionInfo>> getCommandMap() {
3103231032
);
3103331033
webRTCTransportProviderClusterInteractionInfoMap.put("provideAnswer", webRTCTransportProviderprovideAnswerInteractionInfo);
3103431034

31035-
Map<String, CommandParameterInfo> webRTCTransportProviderprovideICECandidateCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
31035+
Map<String, CommandParameterInfo> webRTCTransportProviderprovideICECandidatesCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
3103631036

31037-
CommandParameterInfo webRTCTransportProviderprovideICECandidatewebRTCSessionIDCommandParameterInfo = new CommandParameterInfo("webRTCSessionID", Integer.class, Integer.class);
31038-
webRTCTransportProviderprovideICECandidateCommandParams.put("webRTCSessionID",webRTCTransportProviderprovideICECandidatewebRTCSessionIDCommandParameterInfo);
31037+
CommandParameterInfo webRTCTransportProviderprovideICECandidateswebRTCSessionIDCommandParameterInfo = new CommandParameterInfo("webRTCSessionID", Integer.class, Integer.class);
31038+
webRTCTransportProviderprovideICECandidatesCommandParams.put("webRTCSessionID",webRTCTransportProviderprovideICECandidateswebRTCSessionIDCommandParameterInfo);
3103931039

31040-
CommandParameterInfo webRTCTransportProviderprovideICECandidateICECandidateCommandParameterInfo = new CommandParameterInfo("ICECandidate", String.class, String.class);
31041-
webRTCTransportProviderprovideICECandidateCommandParams.put("ICECandidate",webRTCTransportProviderprovideICECandidateICECandidateCommandParameterInfo);
31042-
InteractionInfo webRTCTransportProviderprovideICECandidateInteractionInfo = new InteractionInfo(
31040+
CommandParameterInfo webRTCTransportProviderprovideICECandidatesICECandidatesCommandParameterInfo = new CommandParameterInfo("ICECandidates", ArrayList.class, ArrayList.class);
31041+
webRTCTransportProviderprovideICECandidatesCommandParams.put("ICECandidates",webRTCTransportProviderprovideICECandidatesICECandidatesCommandParameterInfo);
31042+
InteractionInfo webRTCTransportProviderprovideICECandidatesInteractionInfo = new InteractionInfo(
3104331043
(cluster, callback, commandArguments) -> {
3104431044
((ChipClusters.WebRTCTransportProviderCluster) cluster)
31045-
.provideICECandidate((DefaultClusterCallback) callback
31045+
.provideICECandidates((DefaultClusterCallback) callback
3104631046
, (Integer)
3104731047
commandArguments.get("webRTCSessionID")
31048-
, (String)
31049-
commandArguments.get("ICECandidate")
31048+
, (ArrayList<String>)
31049+
commandArguments.get("ICECandidates")
3105031050
);
3105131051
},
3105231052
() -> new DelegatedDefaultClusterCallback(),
31053-
webRTCTransportProviderprovideICECandidateCommandParams
31053+
webRTCTransportProviderprovideICECandidatesCommandParams
3105431054
);
31055-
webRTCTransportProviderClusterInteractionInfoMap.put("provideICECandidate", webRTCTransportProviderprovideICECandidateInteractionInfo);
31055+
webRTCTransportProviderClusterInteractionInfoMap.put("provideICECandidates", webRTCTransportProviderprovideICECandidatesInteractionInfo);
3105631056

3105731057
Map<String, CommandParameterInfo> webRTCTransportProviderendSessionCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
3105831058

0 commit comments

Comments
 (0)