Skip to content

Commit 3570766

Browse files
pgregorr-amazonpull[bot]
authored andcommitted
iOS tv-casting-app v1.3 Commissioner-Generated passcode flow (#33969)
* iOS tv-casting-app v1.3 Commissioner-Generated passcode flow * Fixing style issues * Addressed comments by sharadb-amazon * Fixing style issues 2 * Addressed comments by sharadb-amazon
1 parent b09f15b commit 3570766

34 files changed

+1613
-273
lines changed

examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java

+24-7
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,40 @@
1313
*/
1414
package com.matter.casting.support;
1515

16-
/** @brief A container struct for User Directed Commissioning (UDC) callbacks. */
16+
/** @brief A container class for User Directed Commissioning (UDC) callbacks. */
1717
public class ConnectionCallbacks {
1818

19-
/** (Required) The callback called when the connection is established successfully. */
19+
/** The callback called when the connection is established successfully. */
2020
public final MatterCallback<Void> onSuccess;
2121

22-
/** (Required) The callback called with MatterError when the connection is fails to establish. */
22+
/** The callback called with MatterError when the connection is fails to establish. */
2323
public final MatterCallback<MatterError> onFailure;
2424

2525
/**
26-
* (Optional) The callback called when the Client/Commissionee receives a CommissionerDeclaration
27-
* message from the CastingPlayer/Commissioner. This callback is needed to support UDC features
28-
* where a reply from the Commissioner is expected. It provides information indicating the
29-
* Commissioner’s pre-commissioning state.
26+
* The callback called when the Client/Commissionee receives a CommissionerDeclaration message
27+
* from the CastingPlayer/Commissioner. This callback is needed to support UDC features where a
28+
* reply from the Commissioner is expected. It provides information indicating the Commissioner’s
29+
* pre-commissioning state.
3030
*/
3131
public MatterCallback<CommissionerDeclaration> onCommissionerDeclaration;
3232

33+
/**
34+
* The constructor for ConnectionCallbacks, the container class for User Directed Commissioning
35+
* (UDC) callbacks.
36+
*
37+
* @param onSuccess (Required) The callback called when the connection is established
38+
* successfully.
39+
* @param onFailure (Required) The callback called with MatterError when the connection is fails
40+
* to establish.
41+
* @param onCommissionerDeclaration (Optional) The callback called when the Client/Commissionee
42+
* receives a CommissionerDeclaration message from the CastingPlayer/Commissioner. This
43+
* callback is needed to support UDC features where a reply from the Commissioner is expected.
44+
* It provides information indicating the Commissioner’s pre-commissioning state.
45+
* <p>For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the
46+
* Commissioner replies with a CommissionerDeclaration message with PasscodeDialogDisplayed
47+
* and CommissionerPasscode set to true. Given these Commissioner state details, the client is
48+
* expected to perform some actions and responf accrdingly.
49+
*/
3350
public ConnectionCallbacks(
3451
MatterCallback<Void> onSuccess,
3552
MatterCallback<MatterError> onFailure,

examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
/**
2121
* This class contains the optional parameters used in the IdentificationDeclaration Message, sent
22-
* by the Commissionee to the Commissioner. The options specify information relating to the
23-
* requested UDC commissioning session.
22+
* by the Commissionee (CastingApp) to the Commissioner (CastingPlayer). The options specify
23+
* information relating to the requested UDC commissioning session.
2424
*/
2525
public class IdentificationDeclarationOptions {
2626
private final String TAG = IdentificationDeclarationOptions.class.getSimpleName();

examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
package com.matter.casting.support;
1515

1616
/**
17-
* Feature: Target Content Application - The set of content app Vendor IDs (and optionally, Product
18-
* IDs) that can be used for authentication.
17+
* Feature: Target Content Application - An entry in the IdentificationDeclarationOptions.java
18+
* TargetAppList which contains a TargetVendorId and an optional TargetProductId.
1919
*/
2020
public class TargetAppInfo {
2121
/** Target Target Content Application Vendor ID, null means unspecified */

examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h

+7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ class MatterCastingPlayerJNI
5050
private:
5151
friend MatterCastingPlayerJNI & MatterCastingPlayerJNIMgr();
5252
static MatterCastingPlayerJNI sInstance;
53+
54+
// Handles the connection complete event and calls the ConnectionCallbacks onSuccess or onFailure callback provided by the Java
55+
// client. This callback is called by the cpp layer when the connection process has ended, regardless of whether it was
56+
// successful or not.
5357
static void ConnectCallback(CHIP_ERROR err, CastingPlayer * playerPtr);
58+
// Handles the Commissioner Declaration event and calls the ConnectionCallbacks onCommissionerDeclaration callback provided by
59+
// the Java client. This callback is called by the cpp layer when the Commissionee receives a CommissionerDeclaration message
60+
// from the CastingPlayer/Commissioner.
5461
static void CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source,
5562
chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd);
5663
};

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj

+44
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
393039D52C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 393039D42C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h */; };
11+
3938C1ED2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3938C1EC2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h */; };
1012
39589F162B91556B00BE040C /* MCInteractionModelStructs.h in Headers */ = {isa = PBXBuildFile; fileRef = 39589F152B91556B00BE040C /* MCInteractionModelStructs.h */; };
1113
39589F182B91557700BE040C /* MCInteractionModelStructs.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39589F172B91557700BE040C /* MCInteractionModelStructs.mm */; };
14+
395BF6AF2C18EC7C00C73CE2 /* MCTargetAppInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 395BF6AE2C18EC7C00C73CE2 /* MCTargetAppInfo.mm */; };
15+
397099D92C2255FE00B34428 /* MCCastingApp_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 397099D82C2255FE00B34428 /* MCCastingApp_Internal.h */; };
16+
399BCE1E2C13CBAD0075AA85 /* MCTargetAppInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */; };
1217
39BF57C52B8CFF790081653C /* MCAttributeObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57C42B8CFF790081653C /* MCAttributeObjects.h */; };
1318
39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */; };
1419
39BF57C92B8D66540081653C /* NSStringSpanConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57C82B8D66540081653C /* NSStringSpanConversion.h */; };
@@ -19,6 +24,12 @@
1924
39D4D2522B97943D00BF3CFE /* MCCommandObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39D4D2512B97943D00BF3CFE /* MCCommandObjects.mm */; };
2025
39DB29E92B9A3B1D0071334A /* MCCommandPayloads.h in Headers */ = {isa = PBXBuildFile; fileRef = 39DB29E82B9A3B1D0071334A /* MCCommandPayloads.h */; };
2126
39DB29EB2B9A3B2D0071334A /* MCCommandPayloads.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39DB29EA2B9A3B2D0071334A /* MCCommandPayloads.mm */; };
27+
39F589DA2C176EA4000AAADD /* MCIdentificationDeclarationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */; };
28+
39F589DC2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */; };
29+
39F589DE2C1781C8000AAADD /* MCCommissionerDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */; };
30+
39F589E02C1781E4000AAADD /* MCCommissionerDeclaration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */; };
31+
39F589E22C179A09000AAADD /* MCConnectionCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */; };
32+
39F589E42C179A18000AAADD /* MCConnectionCallbacks.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */; };
2233
3C0474062B3F7E5F0012AE95 /* MCEndpointFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */; };
2334
3C04740C2B4604CF0012AE95 /* MCCryptoUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C04740B2B4604CF0012AE95 /* MCCryptoUtils.h */; };
2435
3C04740E2B4605B40012AE95 /* MCCryptoUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C04740D2B4605B40012AE95 /* MCCryptoUtils.mm */; };
@@ -81,9 +92,14 @@
8192
/* End PBXBuildFile section */
8293

8394
/* Begin PBXFileReference section */
95+
393039D42C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCIdentificationDeclarationOptions_Internal.h; sourceTree = "<group>"; };
96+
3938C1EC2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommissionerDeclaration_Internal.h; sourceTree = "<group>"; };
8497
39589F152B91556B00BE040C /* MCInteractionModelStructs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCInteractionModelStructs.h; sourceTree = "<group>"; };
8598
39589F172B91557700BE040C /* MCInteractionModelStructs.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCInteractionModelStructs.mm; sourceTree = "<group>"; };
99+
395BF6AE2C18EC7C00C73CE2 /* MCTargetAppInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCTargetAppInfo.mm; sourceTree = "<group>"; };
100+
397099D82C2255FE00B34428 /* MCCastingApp_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCastingApp_Internal.h; sourceTree = "<group>"; };
86101
399049A62B9FC4ED000C91F0 /* MCCommandPayloads_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommandPayloads_Internal.h; sourceTree = "<group>"; };
102+
399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCTargetAppInfo.h; sourceTree = "<group>"; };
87103
39BF57C42B8CFF790081653C /* MCAttributeObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCAttributeObjects.h; sourceTree = "<group>"; };
88104
39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCAttributeObjects.mm; sourceTree = "<group>"; };
89105
39BF57C82B8D66540081653C /* NSStringSpanConversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSStringSpanConversion.h; sourceTree = "<group>"; };
@@ -94,6 +110,12 @@
94110
39D4D2512B97943D00BF3CFE /* MCCommandObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommandObjects.mm; sourceTree = "<group>"; };
95111
39DB29E82B9A3B1D0071334A /* MCCommandPayloads.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommandPayloads.h; sourceTree = "<group>"; };
96112
39DB29EA2B9A3B2D0071334A /* MCCommandPayloads.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommandPayloads.mm; sourceTree = "<group>"; };
113+
39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCIdentificationDeclarationOptions.h; sourceTree = "<group>"; };
114+
39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCIdentificationDeclarationOptions.mm; sourceTree = "<group>"; };
115+
39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommissionerDeclaration.h; sourceTree = "<group>"; };
116+
39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommissionerDeclaration.mm; sourceTree = "<group>"; };
117+
39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCConnectionCallbacks.h; sourceTree = "<group>"; };
118+
39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCConnectionCallbacks.mm; sourceTree = "<group>"; };
97119
3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCEndpointFilter.h; sourceTree = "<group>"; };
98120
3C04740B2B4604CF0012AE95 /* MCCryptoUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCryptoUtils.h; sourceTree = "<group>"; };
99121
3C04740D2B4605B40012AE95 /* MCCryptoUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCryptoUtils.mm; sourceTree = "<group>"; };
@@ -255,6 +277,7 @@
255277
395241F42B854EA700F7DB91 /* zap-generated */,
256278
3CCB87202869085400771BAD /* MatterTvCastingBridge.h */,
257279
3CF71C092A992D0D003A5CE5 /* MCCastingApp.h */,
280+
397099D82C2255FE00B34428 /* MCCastingApp_Internal.h */,
258281
3CF71C0B2A992D25003A5CE5 /* MCCastingApp.mm */,
259282
3C2346222B362B9500FA276E /* MCCastingPlayerDiscovery.h */,
260283
3C2346242B362BBB00FA276E /* MCCastingPlayerDiscovery.mm */,
@@ -276,6 +299,16 @@
276299
3C4F52132B4F31DC00BB8A10 /* MCDeviceTypeStruct.h */,
277300
3C4F52152B4F31FA00BB8A10 /* MCDeviceTypeStruct.m */,
278301
3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */,
302+
399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */,
303+
395BF6AE2C18EC7C00C73CE2 /* MCTargetAppInfo.mm */,
304+
39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */,
305+
39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */,
306+
39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */,
307+
3938C1EC2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h */,
308+
39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */,
309+
39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */,
310+
393039D42C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h */,
311+
39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */,
279312
3C2696FA2B4A5FC50026E771 /* MCEndpointFilter.m */,
280313
3CF71C0D2A992DA2003A5CE5 /* MCDataSource.h */,
281314
3CF71C0F2A99312D003A5CE5 /* MCCommissionableData.h */,
@@ -312,19 +345,25 @@
312345
3C2346212B362B4F00FA276E /* MCCastingPlayer.h in Headers */,
313346
3C2346232B362B9500FA276E /* MCCastingPlayerDiscovery.h in Headers */,
314347
3CF71C0E2A992DA2003A5CE5 /* MCDataSource.h in Headers */,
348+
3938C1ED2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h in Headers */,
315349
3C4F52142B4F31DC00BB8A10 /* MCDeviceTypeStruct.h in Headers */,
316350
39BF57CD2B8FC0EF0081653C /* MCClusterObjects.h in Headers */,
317351
39D4D2502B97942D00BF3CFE /* MCCommandObjects.h in Headers */,
318352
3C621CA52B605A6A005CDBA3 /* MCAttribute.h in Headers */,
353+
397099D92C2255FE00B34428 /* MCCastingApp_Internal.h in Headers */,
319354
3CD73F1C2A9E8396009D82D1 /* MCCommissionableDataProvider.h in Headers */,
320355
3C4F521E2B4F4B3B00BB8A10 /* MCEndpoint_Internal.h in Headers */,
321356
39BF57C92B8D66540081653C /* NSStringSpanConversion.h in Headers */,
357+
399BCE1E2C13CBAD0075AA85 /* MCTargetAppInfo.h in Headers */,
322358
39DB29E92B9A3B1D0071334A /* MCCommandPayloads.h in Headers */,
359+
39F589DE2C1781C8000AAADD /* MCCommissionerDeclaration.h in Headers */,
323360
3C4F52262B50899700BB8A10 /* MCCluster_Internal.h in Headers */,
361+
39F589DA2C176EA4000AAADD /* MCIdentificationDeclarationOptions.h in Headers */,
324362
3CF71C0A2A992D0D003A5CE5 /* MCCastingApp.h in Headers */,
325363
3C4F521C2B4F4B1B00BB8A10 /* MCCastingPlayer_Internal.h in Headers */,
326364
3CD73F172A9E6884009D82D1 /* MCRotatingDeviceIdUniqueIdProvider.h in Headers */,
327365
3C4F52102B4E18C800BB8A10 /* MCEndpoint.h in Headers */,
366+
393039D52C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h in Headers */,
328367
3C4F52282B51DB3000BB8A10 /* MCCommand.h in Headers */,
329368
39BF57CB2B8E54F80081653C /* NSDataSpanConversion.h in Headers */,
330369
3C621CA92B605C52005CDBA3 /* MCAttribute_Internal.h in Headers */,
@@ -336,6 +375,7 @@
336375
39589F162B91556B00BE040C /* MCInteractionModelStructs.h in Headers */,
337376
3C9437922B3B478E0096E5F4 /* MCErrorUtils.h in Headers */,
338377
3C4F52222B507C9300BB8A10 /* MCCluster.h in Headers */,
378+
39F589E22C179A09000AAADD /* MCConnectionCallbacks.h in Headers */,
339379
3CCB8741286A593700771BAD /* DiscoveredNodeData.h in Headers */,
340380
3C0474062B3F7E5F0012AE95 /* MCEndpointFilter.h in Headers */,
341381
3CCB87212869085400771BAD /* MatterTvCastingBridge.h in Headers */,
@@ -449,18 +489,22 @@
449489
39BF57CF2B8FC1030081653C /* MCClusterObjects.mm in Sources */,
450490
3CD73F192A9E68A7009D82D1 /* MCRotatingDeviceIdUniqueIdProvider.mm in Sources */,
451491
39589F182B91557700BE040C /* MCInteractionModelStructs.mm in Sources */,
492+
39F589DC2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm in Sources */,
452493
39DB29EB2B9A3B2D0071334A /* MCCommandPayloads.mm in Sources */,
453494
3CF8532728E37F1000F07B9F /* MatterError.mm in Sources */,
454495
3C4F522C2B51E02800BB8A10 /* MCCommand.mm in Sources */,
496+
395BF6AF2C18EC7C00C73CE2 /* MCTargetAppInfo.mm in Sources */,
455497
3C4E53B628E5595A00F293E8 /* ContentLauncherTypes.mm in Sources */,
456498
3C81C75028F7A7D3001CB9D1 /* VideoPlayer.m in Sources */,
457499
3CF71C0C2A992D25003A5CE5 /* MCCastingApp.mm in Sources */,
458500
3CC3979E2BE9857C00465462 /* MCCastingPlayer.mm in Sources */,
459501
3C621CAB2B605C6E005CDBA3 /* MCAttribute.mm in Sources */,
502+
39F589E42C179A18000AAADD /* MCConnectionCallbacks.mm in Sources */,
460503
3C4F52122B4E18ED00BB8A10 /* MCEndpoint.mm in Sources */,
461504
3C4E53B028E4F28100F293E8 /* MediaPlaybackTypes.mm in Sources */,
462505
3C04740E2B4605B40012AE95 /* MCCryptoUtils.mm in Sources */,
463506
3CD73F1E2A9E83C1009D82D1 /* MCCommissionableDataProvider.mm in Sources */,
507+
39F589E02C1781E4000AAADD /* MCCommissionerDeclaration.mm in Sources */,
464508
3CD73F222A9EA078009D82D1 /* MCDeviceAttestationCredentials.mm in Sources */,
465509
39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */,
466510
3C2346252B362BBB00FA276E /* MCCastingPlayerDiscovery.mm in Sources */,

0 commit comments

Comments
 (0)