Skip to content

Commit 7d0faf9

Browse files
iOS tv-casting-app v1.3 Commissioner-Generated passcode flow
1 parent c9bcd22 commit 7d0faf9

29 files changed

+1465
-255
lines changed

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/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj

+40
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
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+
399BCE1E2C13CBAD0075AA85 /* MCTargetAppInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */; };
1216
39BF57C52B8CFF790081653C /* MCAttributeObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57C42B8CFF790081653C /* MCAttributeObjects.h */; };
1317
39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */; };
1418
39BF57C92B8D66540081653C /* NSStringSpanConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57C82B8D66540081653C /* NSStringSpanConversion.h */; };
@@ -19,6 +23,12 @@
1923
39D4D2522B97943D00BF3CFE /* MCCommandObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39D4D2512B97943D00BF3CFE /* MCCommandObjects.mm */; };
2024
39DB29E92B9A3B1D0071334A /* MCCommandPayloads.h in Headers */ = {isa = PBXBuildFile; fileRef = 39DB29E82B9A3B1D0071334A /* MCCommandPayloads.h */; };
2125
39DB29EB2B9A3B2D0071334A /* MCCommandPayloads.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39DB29EA2B9A3B2D0071334A /* MCCommandPayloads.mm */; };
26+
39F589DA2C176EA4000AAADD /* MCIdentificationDeclarationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */; };
27+
39F589DC2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */; };
28+
39F589DE2C1781C8000AAADD /* MCCommissionerDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */; };
29+
39F589E02C1781E4000AAADD /* MCCommissionerDeclaration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */; };
30+
39F589E22C179A09000AAADD /* MCConnectionCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */; };
31+
39F589E42C179A18000AAADD /* MCConnectionCallbacks.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */; };
2232
3C0474062B3F7E5F0012AE95 /* MCEndpointFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */; };
2333
3C04740C2B4604CF0012AE95 /* MCCryptoUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C04740B2B4604CF0012AE95 /* MCCryptoUtils.h */; };
2434
3C04740E2B4605B40012AE95 /* MCCryptoUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C04740D2B4605B40012AE95 /* MCCryptoUtils.mm */; };
@@ -81,9 +91,13 @@
8191
/* End PBXBuildFile section */
8292

8393
/* Begin PBXFileReference section */
94+
393039D42C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCIdentificationDeclarationOptions_Internal.h; sourceTree = "<group>"; };
95+
3938C1EC2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommissionerDeclaration_Internal.h; sourceTree = "<group>"; };
8496
39589F152B91556B00BE040C /* MCInteractionModelStructs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCInteractionModelStructs.h; sourceTree = "<group>"; };
8597
39589F172B91557700BE040C /* MCInteractionModelStructs.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCInteractionModelStructs.mm; sourceTree = "<group>"; };
98+
395BF6AE2C18EC7C00C73CE2 /* MCTargetAppInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCTargetAppInfo.mm; sourceTree = "<group>"; };
8699
399049A62B9FC4ED000C91F0 /* MCCommandPayloads_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommandPayloads_Internal.h; sourceTree = "<group>"; };
100+
399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCTargetAppInfo.h; sourceTree = "<group>"; };
87101
39BF57C42B8CFF790081653C /* MCAttributeObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCAttributeObjects.h; sourceTree = "<group>"; };
88102
39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCAttributeObjects.mm; sourceTree = "<group>"; };
89103
39BF57C82B8D66540081653C /* NSStringSpanConversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSStringSpanConversion.h; sourceTree = "<group>"; };
@@ -94,6 +108,12 @@
94108
39D4D2512B97943D00BF3CFE /* MCCommandObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommandObjects.mm; sourceTree = "<group>"; };
95109
39DB29E82B9A3B1D0071334A /* MCCommandPayloads.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommandPayloads.h; sourceTree = "<group>"; };
96110
39DB29EA2B9A3B2D0071334A /* MCCommandPayloads.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommandPayloads.mm; sourceTree = "<group>"; };
111+
39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCIdentificationDeclarationOptions.h; sourceTree = "<group>"; };
112+
39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCIdentificationDeclarationOptions.mm; sourceTree = "<group>"; };
113+
39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommissionerDeclaration.h; sourceTree = "<group>"; };
114+
39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommissionerDeclaration.mm; sourceTree = "<group>"; };
115+
39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCConnectionCallbacks.h; sourceTree = "<group>"; };
116+
39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCConnectionCallbacks.mm; sourceTree = "<group>"; };
97117
3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCEndpointFilter.h; sourceTree = "<group>"; };
98118
3C04740B2B4604CF0012AE95 /* MCCryptoUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCryptoUtils.h; sourceTree = "<group>"; };
99119
3C04740D2B4605B40012AE95 /* MCCryptoUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCryptoUtils.mm; sourceTree = "<group>"; };
@@ -276,6 +296,16 @@
276296
3C4F52132B4F31DC00BB8A10 /* MCDeviceTypeStruct.h */,
277297
3C4F52152B4F31FA00BB8A10 /* MCDeviceTypeStruct.m */,
278298
3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */,
299+
399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */,
300+
395BF6AE2C18EC7C00C73CE2 /* MCTargetAppInfo.mm */,
301+
39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */,
302+
39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */,
303+
39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */,
304+
3938C1EC2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h */,
305+
39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */,
306+
39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */,
307+
393039D42C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h */,
308+
39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */,
279309
3C2696FA2B4A5FC50026E771 /* MCEndpointFilter.m */,
280310
3CF71C0D2A992DA2003A5CE5 /* MCDataSource.h */,
281311
3CF71C0F2A99312D003A5CE5 /* MCCommissionableData.h */,
@@ -312,19 +342,24 @@
312342
3C2346212B362B4F00FA276E /* MCCastingPlayer.h in Headers */,
313343
3C2346232B362B9500FA276E /* MCCastingPlayerDiscovery.h in Headers */,
314344
3CF71C0E2A992DA2003A5CE5 /* MCDataSource.h in Headers */,
345+
3938C1ED2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h in Headers */,
315346
3C4F52142B4F31DC00BB8A10 /* MCDeviceTypeStruct.h in Headers */,
316347
39BF57CD2B8FC0EF0081653C /* MCClusterObjects.h in Headers */,
317348
39D4D2502B97942D00BF3CFE /* MCCommandObjects.h in Headers */,
318349
3C621CA52B605A6A005CDBA3 /* MCAttribute.h in Headers */,
319350
3CD73F1C2A9E8396009D82D1 /* MCCommissionableDataProvider.h in Headers */,
320351
3C4F521E2B4F4B3B00BB8A10 /* MCEndpoint_Internal.h in Headers */,
321352
39BF57C92B8D66540081653C /* NSStringSpanConversion.h in Headers */,
353+
399BCE1E2C13CBAD0075AA85 /* MCTargetAppInfo.h in Headers */,
322354
39DB29E92B9A3B1D0071334A /* MCCommandPayloads.h in Headers */,
355+
39F589DE2C1781C8000AAADD /* MCCommissionerDeclaration.h in Headers */,
323356
3C4F52262B50899700BB8A10 /* MCCluster_Internal.h in Headers */,
357+
39F589DA2C176EA4000AAADD /* MCIdentificationDeclarationOptions.h in Headers */,
324358
3CF71C0A2A992D0D003A5CE5 /* MCCastingApp.h in Headers */,
325359
3C4F521C2B4F4B1B00BB8A10 /* MCCastingPlayer_Internal.h in Headers */,
326360
3CD73F172A9E6884009D82D1 /* MCRotatingDeviceIdUniqueIdProvider.h in Headers */,
327361
3C4F52102B4E18C800BB8A10 /* MCEndpoint.h in Headers */,
362+
393039D52C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h in Headers */,
328363
3C4F52282B51DB3000BB8A10 /* MCCommand.h in Headers */,
329364
39BF57CB2B8E54F80081653C /* NSDataSpanConversion.h in Headers */,
330365
3C621CA92B605C52005CDBA3 /* MCAttribute_Internal.h in Headers */,
@@ -336,6 +371,7 @@
336371
39589F162B91556B00BE040C /* MCInteractionModelStructs.h in Headers */,
337372
3C9437922B3B478E0096E5F4 /* MCErrorUtils.h in Headers */,
338373
3C4F52222B507C9300BB8A10 /* MCCluster.h in Headers */,
374+
39F589E22C179A09000AAADD /* MCConnectionCallbacks.h in Headers */,
339375
3CCB8741286A593700771BAD /* DiscoveredNodeData.h in Headers */,
340376
3C0474062B3F7E5F0012AE95 /* MCEndpointFilter.h in Headers */,
341377
3CCB87212869085400771BAD /* MatterTvCastingBridge.h in Headers */,
@@ -449,18 +485,22 @@
449485
39BF57CF2B8FC1030081653C /* MCClusterObjects.mm in Sources */,
450486
3CD73F192A9E68A7009D82D1 /* MCRotatingDeviceIdUniqueIdProvider.mm in Sources */,
451487
39589F182B91557700BE040C /* MCInteractionModelStructs.mm in Sources */,
488+
39F589DC2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm in Sources */,
452489
39DB29EB2B9A3B2D0071334A /* MCCommandPayloads.mm in Sources */,
453490
3CF8532728E37F1000F07B9F /* MatterError.mm in Sources */,
454491
3C4F522C2B51E02800BB8A10 /* MCCommand.mm in Sources */,
492+
395BF6AF2C18EC7C00C73CE2 /* MCTargetAppInfo.mm in Sources */,
455493
3C4E53B628E5595A00F293E8 /* ContentLauncherTypes.mm in Sources */,
456494
3C81C75028F7A7D3001CB9D1 /* VideoPlayer.m in Sources */,
457495
3CF71C0C2A992D25003A5CE5 /* MCCastingApp.mm in Sources */,
458496
3CC3979E2BE9857C00465462 /* MCCastingPlayer.mm in Sources */,
459497
3C621CAB2B605C6E005CDBA3 /* MCAttribute.mm in Sources */,
498+
39F589E42C179A18000AAADD /* MCConnectionCallbacks.mm in Sources */,
460499
3C4F52122B4E18ED00BB8A10 /* MCEndpoint.mm in Sources */,
461500
3C4E53B028E4F28100F293E8 /* MediaPlaybackTypes.mm in Sources */,
462501
3C04740E2B4605B40012AE95 /* MCCryptoUtils.mm in Sources */,
463502
3CD73F1E2A9E83C1009D82D1 /* MCCommissionableDataProvider.mm in Sources */,
503+
39F589E02C1781E4000AAADD /* MCCommissionerDeclaration.mm in Sources */,
464504
3CD73F222A9EA078009D82D1 /* MCDeviceAttestationCredentials.mm in Sources */,
465505
39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */,
466506
3C2346252B362BBB00FA276E /* MCCastingPlayerDiscovery.mm in Sources */,

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCastingApp.h

+10
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@
4242
*/
4343
- (NSError * _Nullable)initializeWithDataSource:(id<MCDataSource> _Nonnull)dataSource;
4444

45+
/**
46+
* @brief Updates the MCCommissionableDataProvider stored in this CastingApp with the new CommissionableData
47+
* to be used for the next commissioning session. Calling this function is mandatory for the
48+
* Casting Player/Commissioner-Generated passcode commissioning flow, since the commissioning session's PAKE
49+
* verifier needs to be updated with the user entered passcode.
50+
*
51+
* @param newCommissionableData the new MCCommissionableData to be used for the next commissioning session.
52+
*/
53+
- (NSError * _Nullable)updateCommissionableDataProvider:(MCCommissionableData * _Nonnull)newCommissionableData;
54+
4555
/**
4656
* @brief (async) Starts the Matter server that the MCCastingApp runs on and registers all the necessary delegates
4757
*/

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCastingApp.mm

+28-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ @interface MCCastingApp ()
4343
// queue used to perform all work performed by the MatterTvCastingBridge
4444
@property (atomic) dispatch_queue_t workQueue;
4545

46+
// used to update the commissionableDataProvider post initialization, this is necessary for the
47+
// Commissioner-Generated passcode commissioning feature.
48+
@property (nonatomic, strong) id<MCDataSource> dataSource;
49+
4650
@end
4751

4852
@implementation MCCastingApp
@@ -69,7 +73,8 @@ - (dispatch_queue_t)getClientQueue
6973

7074
- (NSError *)initializeWithDataSource:(id)dataSource
7175
{
72-
ChipLogProgress(AppServer, "MCCastingApp.initializeWithDataSource called");
76+
ChipLogProgress(AppServer, "MCCastingApp.initializeWithDataSource() called");
77+
_dataSource = dataSource;
7378

7479
// get the clientQueue
7580
VerifyOrReturnValue([dataSource clientQueue] != nil, [MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);
@@ -78,6 +83,7 @@ - (NSError *)initializeWithDataSource:(id)dataSource
7883
// Initialize cpp Providers
7984
VerifyOrReturnValue(_uniqueIdProvider.Initialize(dataSource) == CHIP_NO_ERROR, [MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);
8085

86+
ChipLogProgress(AppServer, "MCCastingApp.initializeWithDataSource() calling MCCommissionableDataProvider.Initialize()");
8187
_commissionableDataProvider = new matter::casting::support::MCCommissionableDataProvider();
8288
VerifyOrReturnValue(_commissionableDataProvider->Initialize(dataSource) == CHIP_NO_ERROR, [MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);
8389

@@ -92,6 +98,7 @@ - (NSError *)initializeWithDataSource:(id)dataSource
9298
== CHIP_NO_ERROR,
9399
[MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);
94100

101+
ChipLogProgress(AppServer, "MCCastingApp.initializeWithDataSource() calling cpp CastingApp::Initialize()");
95102
// Initialize cpp CastingApp
96103
VerifyOrReturnValue(matter::casting::core::CastingApp::GetInstance()->Initialize(_appParameters) == CHIP_NO_ERROR,
97104
[MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE]);
@@ -102,6 +109,26 @@ - (NSError *)initializeWithDataSource:(id)dataSource
102109
return [MCErrorUtils NSErrorFromChipError:CHIP_NO_ERROR];
103110
}
104111

112+
- (NSError *)updateCommissionableDataProvider:(MCCommissionableData *)newCommissionableData
113+
{
114+
ChipLogProgress(AppServer, "MCCastingApp.UpdateCommissionableDataProvider() called");
115+
116+
if (_dataSource) {
117+
[_dataSource update:newCommissionableData];
118+
}
119+
120+
_commissionableDataProvider = new matter::casting::support::MCCommissionableDataProvider();
121+
VerifyOrReturnValue(_commissionableDataProvider->Initialize(_dataSource) == CHIP_NO_ERROR,
122+
[MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INVALID_ARGUMENT]);
123+
124+
ChipLogProgress(AppServer, "MCCastingApp.initializeWithDataSource() calling cpp CastingApp::UpdateCommissionableDataProvider()");
125+
// Update cpp CastingApp CommissionableDataProvider
126+
VerifyOrReturnValue(matter::casting::core::CastingApp::GetInstance()->UpdateCommissionableDataProvider(_commissionableDataProvider) == CHIP_NO_ERROR,
127+
[MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE]);
128+
129+
return [MCErrorUtils NSErrorFromChipError:CHIP_NO_ERROR];
130+
}
131+
105132
- (void)startWithCompletionBlock:(void (^)(NSError *))completion
106133
{
107134
ChipLogProgress(AppServer, "MCCastingApp.startWithCompletionBlock called");

0 commit comments

Comments
 (0)