Skip to content

Commit

Permalink
Align XML definations for WebRTC Requester cluster with spec
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Feb 19, 2025
1 parent 33aec35 commit 38f18f2
Show file tree
Hide file tree
Showing 24 changed files with 148 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Source: src/app_clusters/WebRTC_Requestor.adoc
Parameters: in-progress
Git: 0.9-fall2024-228-g54b1ae035
-->
<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>
Expand All @@ -46,10 +46,10 @@ Git: 0.9-fall2024-228-g54b1ae035
<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 provides an ICE candidates to the stream requestor in a WebRTC session.</description>
<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">
Expand Down
8 changes: 4 additions & 4 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -10260,9 +10260,9 @@ 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 {
Expand All @@ -10274,8 +10274,8 @@ provisional cluster WebRTCTransportRequestor = 1364 {
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. */
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 provides an ICE candidates to the stream requestor in a WebRTC session. */
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.

6 changes: 3 additions & 3 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.

6 changes: 3 additions & 3 deletions src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm

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

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

4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm

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

2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/zap-generated/MTRClusters.h

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

6 changes: 3 additions & 3 deletions src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm

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

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

Loading

0 comments on commit 38f18f2

Please sign in to comment.