Skip to content

Commit

Permalink
iOS tv-casting-app v1.3 Commissioner-Generated passcode flow (project…
Browse files Browse the repository at this point in the history
…-chip#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
  • Loading branch information
pgregorr-amazon authored Jun 23, 2024
1 parent c829a2c commit 07ac2f1
Show file tree
Hide file tree
Showing 34 changed files with 1,613 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,40 @@
*/
package com.matter.casting.support;

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

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

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

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

/**
* The constructor for ConnectionCallbacks, the container class for User Directed Commissioning
* (UDC) callbacks.
*
* @param onSuccess (Required) The callback called when the connection is established
* successfully.
* @param onFailure (Required) The callback called with MatterError when the connection is fails
* to establish.
* @param onCommissionerDeclaration (Optional) The callback called when the Client/Commissionee
* receives a CommissionerDeclaration message from the CastingPlayer/Commissioner. This
* callback is needed to support UDC features where a reply from the Commissioner is expected.
* It provides information indicating the Commissioner’s pre-commissioning state.
* <p>For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the
* Commissioner replies with a CommissionerDeclaration message with PasscodeDialogDisplayed
* and CommissionerPasscode set to true. Given these Commissioner state details, the client is
* expected to perform some actions and responf accrdingly.
*/
public ConnectionCallbacks(
MatterCallback<Void> onSuccess,
MatterCallback<MatterError> onFailure,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

/**
* This class contains the optional parameters used in the IdentificationDeclaration Message, sent
* by the Commissionee to the Commissioner. The options specify information relating to the
* requested UDC commissioning session.
* by the Commissionee (CastingApp) to the Commissioner (CastingPlayer). The options specify
* information relating to the requested UDC commissioning session.
*/
public class IdentificationDeclarationOptions {
private final String TAG = IdentificationDeclarationOptions.class.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
package com.matter.casting.support;

/**
* Feature: Target Content Application - The set of content app Vendor IDs (and optionally, Product
* IDs) that can be used for authentication.
* Feature: Target Content Application - An entry in the IdentificationDeclarationOptions.java
* TargetAppList which contains a TargetVendorId and an optional TargetProductId.
*/
public class TargetAppInfo {
/** Target Target Content Application Vendor ID, null means unspecified */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ class MatterCastingPlayerJNI
private:
friend MatterCastingPlayerJNI & MatterCastingPlayerJNIMgr();
static MatterCastingPlayerJNI sInstance;

// Handles the connection complete event and calls the ConnectionCallbacks onSuccess or onFailure callback provided by the Java
// client. This callback is called by the cpp layer when the connection process has ended, regardless of whether it was
// successful or not.
static void ConnectCallback(CHIP_ERROR err, CastingPlayer * playerPtr);
// Handles the Commissioner Declaration event and calls the ConnectionCallbacks onCommissionerDeclaration callback provided by
// the Java client. This callback is called by the cpp layer when the Commissionee receives a CommissionerDeclaration message
// from the CastingPlayer/Commissioner.
static void CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source,
chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
393039D52C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 393039D42C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h */; };
3938C1ED2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3938C1EC2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h */; };
39589F162B91556B00BE040C /* MCInteractionModelStructs.h in Headers */ = {isa = PBXBuildFile; fileRef = 39589F152B91556B00BE040C /* MCInteractionModelStructs.h */; };
39589F182B91557700BE040C /* MCInteractionModelStructs.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39589F172B91557700BE040C /* MCInteractionModelStructs.mm */; };
395BF6AF2C18EC7C00C73CE2 /* MCTargetAppInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 395BF6AE2C18EC7C00C73CE2 /* MCTargetAppInfo.mm */; };
397099D92C2255FE00B34428 /* MCCastingApp_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 397099D82C2255FE00B34428 /* MCCastingApp_Internal.h */; };
399BCE1E2C13CBAD0075AA85 /* MCTargetAppInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */; };
39BF57C52B8CFF790081653C /* MCAttributeObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57C42B8CFF790081653C /* MCAttributeObjects.h */; };
39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */; };
39BF57C92B8D66540081653C /* NSStringSpanConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57C82B8D66540081653C /* NSStringSpanConversion.h */; };
Expand All @@ -19,6 +24,12 @@
39D4D2522B97943D00BF3CFE /* MCCommandObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39D4D2512B97943D00BF3CFE /* MCCommandObjects.mm */; };
39DB29E92B9A3B1D0071334A /* MCCommandPayloads.h in Headers */ = {isa = PBXBuildFile; fileRef = 39DB29E82B9A3B1D0071334A /* MCCommandPayloads.h */; };
39DB29EB2B9A3B2D0071334A /* MCCommandPayloads.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39DB29EA2B9A3B2D0071334A /* MCCommandPayloads.mm */; };
39F589DA2C176EA4000AAADD /* MCIdentificationDeclarationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */; };
39F589DC2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */; };
39F589DE2C1781C8000AAADD /* MCCommissionerDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */; };
39F589E02C1781E4000AAADD /* MCCommissionerDeclaration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */; };
39F589E22C179A09000AAADD /* MCConnectionCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */; };
39F589E42C179A18000AAADD /* MCConnectionCallbacks.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */; };
3C0474062B3F7E5F0012AE95 /* MCEndpointFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */; };
3C04740C2B4604CF0012AE95 /* MCCryptoUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C04740B2B4604CF0012AE95 /* MCCryptoUtils.h */; };
3C04740E2B4605B40012AE95 /* MCCryptoUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C04740D2B4605B40012AE95 /* MCCryptoUtils.mm */; };
Expand Down Expand Up @@ -81,9 +92,14 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
393039D42C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCIdentificationDeclarationOptions_Internal.h; sourceTree = "<group>"; };
3938C1EC2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommissionerDeclaration_Internal.h; sourceTree = "<group>"; };
39589F152B91556B00BE040C /* MCInteractionModelStructs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCInteractionModelStructs.h; sourceTree = "<group>"; };
39589F172B91557700BE040C /* MCInteractionModelStructs.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCInteractionModelStructs.mm; sourceTree = "<group>"; };
395BF6AE2C18EC7C00C73CE2 /* MCTargetAppInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCTargetAppInfo.mm; sourceTree = "<group>"; };
397099D82C2255FE00B34428 /* MCCastingApp_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCastingApp_Internal.h; sourceTree = "<group>"; };
399049A62B9FC4ED000C91F0 /* MCCommandPayloads_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommandPayloads_Internal.h; sourceTree = "<group>"; };
399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCTargetAppInfo.h; sourceTree = "<group>"; };
39BF57C42B8CFF790081653C /* MCAttributeObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCAttributeObjects.h; sourceTree = "<group>"; };
39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCAttributeObjects.mm; sourceTree = "<group>"; };
39BF57C82B8D66540081653C /* NSStringSpanConversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSStringSpanConversion.h; sourceTree = "<group>"; };
Expand All @@ -94,6 +110,12 @@
39D4D2512B97943D00BF3CFE /* MCCommandObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommandObjects.mm; sourceTree = "<group>"; };
39DB29E82B9A3B1D0071334A /* MCCommandPayloads.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommandPayloads.h; sourceTree = "<group>"; };
39DB29EA2B9A3B2D0071334A /* MCCommandPayloads.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommandPayloads.mm; sourceTree = "<group>"; };
39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCIdentificationDeclarationOptions.h; sourceTree = "<group>"; };
39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCIdentificationDeclarationOptions.mm; sourceTree = "<group>"; };
39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommissionerDeclaration.h; sourceTree = "<group>"; };
39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommissionerDeclaration.mm; sourceTree = "<group>"; };
39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCConnectionCallbacks.h; sourceTree = "<group>"; };
39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCConnectionCallbacks.mm; sourceTree = "<group>"; };
3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCEndpointFilter.h; sourceTree = "<group>"; };
3C04740B2B4604CF0012AE95 /* MCCryptoUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCryptoUtils.h; sourceTree = "<group>"; };
3C04740D2B4605B40012AE95 /* MCCryptoUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCryptoUtils.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -255,6 +277,7 @@
395241F42B854EA700F7DB91 /* zap-generated */,
3CCB87202869085400771BAD /* MatterTvCastingBridge.h */,
3CF71C092A992D0D003A5CE5 /* MCCastingApp.h */,
397099D82C2255FE00B34428 /* MCCastingApp_Internal.h */,
3CF71C0B2A992D25003A5CE5 /* MCCastingApp.mm */,
3C2346222B362B9500FA276E /* MCCastingPlayerDiscovery.h */,
3C2346242B362BBB00FA276E /* MCCastingPlayerDiscovery.mm */,
Expand All @@ -276,6 +299,16 @@
3C4F52132B4F31DC00BB8A10 /* MCDeviceTypeStruct.h */,
3C4F52152B4F31FA00BB8A10 /* MCDeviceTypeStruct.m */,
3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */,
399BCE1D2C13CBAD0075AA85 /* MCTargetAppInfo.h */,
395BF6AE2C18EC7C00C73CE2 /* MCTargetAppInfo.mm */,
39F589E12C179A09000AAADD /* MCConnectionCallbacks.h */,
39F589E32C179A18000AAADD /* MCConnectionCallbacks.mm */,
39F589DD2C1781C8000AAADD /* MCCommissionerDeclaration.h */,
3938C1EC2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h */,
39F589DF2C1781E4000AAADD /* MCCommissionerDeclaration.mm */,
39F589D92C176EA4000AAADD /* MCIdentificationDeclarationOptions.h */,
393039D42C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h */,
39F589DB2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm */,
3C2696FA2B4A5FC50026E771 /* MCEndpointFilter.m */,
3CF71C0D2A992DA2003A5CE5 /* MCDataSource.h */,
3CF71C0F2A99312D003A5CE5 /* MCCommissionableData.h */,
Expand Down Expand Up @@ -312,19 +345,25 @@
3C2346212B362B4F00FA276E /* MCCastingPlayer.h in Headers */,
3C2346232B362B9500FA276E /* MCCastingPlayerDiscovery.h in Headers */,
3CF71C0E2A992DA2003A5CE5 /* MCDataSource.h in Headers */,
3938C1ED2C1A1C8D009B2B35 /* MCCommissionerDeclaration_Internal.h in Headers */,
3C4F52142B4F31DC00BB8A10 /* MCDeviceTypeStruct.h in Headers */,
39BF57CD2B8FC0EF0081653C /* MCClusterObjects.h in Headers */,
39D4D2502B97942D00BF3CFE /* MCCommandObjects.h in Headers */,
3C621CA52B605A6A005CDBA3 /* MCAttribute.h in Headers */,
397099D92C2255FE00B34428 /* MCCastingApp_Internal.h in Headers */,
3CD73F1C2A9E8396009D82D1 /* MCCommissionableDataProvider.h in Headers */,
3C4F521E2B4F4B3B00BB8A10 /* MCEndpoint_Internal.h in Headers */,
39BF57C92B8D66540081653C /* NSStringSpanConversion.h in Headers */,
399BCE1E2C13CBAD0075AA85 /* MCTargetAppInfo.h in Headers */,
39DB29E92B9A3B1D0071334A /* MCCommandPayloads.h in Headers */,
39F589DE2C1781C8000AAADD /* MCCommissionerDeclaration.h in Headers */,
3C4F52262B50899700BB8A10 /* MCCluster_Internal.h in Headers */,
39F589DA2C176EA4000AAADD /* MCIdentificationDeclarationOptions.h in Headers */,
3CF71C0A2A992D0D003A5CE5 /* MCCastingApp.h in Headers */,
3C4F521C2B4F4B1B00BB8A10 /* MCCastingPlayer_Internal.h in Headers */,
3CD73F172A9E6884009D82D1 /* MCRotatingDeviceIdUniqueIdProvider.h in Headers */,
3C4F52102B4E18C800BB8A10 /* MCEndpoint.h in Headers */,
393039D52C1CF3C500DE8681 /* MCIdentificationDeclarationOptions_Internal.h in Headers */,
3C4F52282B51DB3000BB8A10 /* MCCommand.h in Headers */,
39BF57CB2B8E54F80081653C /* NSDataSpanConversion.h in Headers */,
3C621CA92B605C52005CDBA3 /* MCAttribute_Internal.h in Headers */,
Expand All @@ -336,6 +375,7 @@
39589F162B91556B00BE040C /* MCInteractionModelStructs.h in Headers */,
3C9437922B3B478E0096E5F4 /* MCErrorUtils.h in Headers */,
3C4F52222B507C9300BB8A10 /* MCCluster.h in Headers */,
39F589E22C179A09000AAADD /* MCConnectionCallbacks.h in Headers */,
3CCB8741286A593700771BAD /* DiscoveredNodeData.h in Headers */,
3C0474062B3F7E5F0012AE95 /* MCEndpointFilter.h in Headers */,
3CCB87212869085400771BAD /* MatterTvCastingBridge.h in Headers */,
Expand Down Expand Up @@ -449,18 +489,22 @@
39BF57CF2B8FC1030081653C /* MCClusterObjects.mm in Sources */,
3CD73F192A9E68A7009D82D1 /* MCRotatingDeviceIdUniqueIdProvider.mm in Sources */,
39589F182B91557700BE040C /* MCInteractionModelStructs.mm in Sources */,
39F589DC2C176EC0000AAADD /* MCIdentificationDeclarationOptions.mm in Sources */,
39DB29EB2B9A3B2D0071334A /* MCCommandPayloads.mm in Sources */,
3CF8532728E37F1000F07B9F /* MatterError.mm in Sources */,
3C4F522C2B51E02800BB8A10 /* MCCommand.mm in Sources */,
395BF6AF2C18EC7C00C73CE2 /* MCTargetAppInfo.mm in Sources */,
3C4E53B628E5595A00F293E8 /* ContentLauncherTypes.mm in Sources */,
3C81C75028F7A7D3001CB9D1 /* VideoPlayer.m in Sources */,
3CF71C0C2A992D25003A5CE5 /* MCCastingApp.mm in Sources */,
3CC3979E2BE9857C00465462 /* MCCastingPlayer.mm in Sources */,
3C621CAB2B605C6E005CDBA3 /* MCAttribute.mm in Sources */,
39F589E42C179A18000AAADD /* MCConnectionCallbacks.mm in Sources */,
3C4F52122B4E18ED00BB8A10 /* MCEndpoint.mm in Sources */,
3C4E53B028E4F28100F293E8 /* MediaPlaybackTypes.mm in Sources */,
3C04740E2B4605B40012AE95 /* MCCryptoUtils.mm in Sources */,
3CD73F1E2A9E83C1009D82D1 /* MCCommissionableDataProvider.mm in Sources */,
39F589E02C1781E4000AAADD /* MCCommissionerDeclaration.mm in Sources */,
3CD73F222A9EA078009D82D1 /* MCDeviceAttestationCredentials.mm in Sources */,
39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */,
3C2346252B362BBB00FA276E /* MCCastingPlayerDiscovery.mm in Sources */,
Expand Down
Loading

0 comments on commit 07ac2f1

Please sign in to comment.