From c0bc80e930d3f6b0f0d20c84b8daa1e424bb4995 Mon Sep 17 00:00:00 2001 From: Philip Gregor Date: Fri, 28 Jun 2024 12:12:39 -0700 Subject: [PATCH] Addressed comments by sharadb-amazon2 --- examples/tv-casting-app/APIs.md | 16 ++++++++-------- .../casting/ConnectionExampleFragment.java | 8 +++++--- .../IdentificationDeclarationOptions.java | 9 --------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/examples/tv-casting-app/APIs.md b/examples/tv-casting-app/APIs.md index 15a7ef38026647..75c63eb2379eac 100644 --- a/examples/tv-casting-app/APIs.md +++ b/examples/tv-casting-app/APIs.md @@ -249,7 +249,7 @@ client's lifecycle: return commissionableData; } - // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature commissioning flow: + // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature: public void updateCommissionableDataSetupPasscode(long setupPasscode, int discriminator) { commissionableData.setSetupPasscode(setupPasscode); commissionableData.setDiscriminator(discriminator); @@ -281,7 +281,7 @@ client's lifecycle: return commissionableData } - // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature commissioning flow: + // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature: func update(_ newCommissionableData: MCCommissionableData) { self.commissionableData = newCommissionableData } @@ -842,7 +842,7 @@ void ConnectionHandler(CHIP_ERROR err, matter::casting::core::CastingPlayer * ca } } -// If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature commissioning flow: +// If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature: // Define a callback to handle CastingPlayer’s CommissionerDeclaration messages. void CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source, chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd) @@ -889,7 +889,7 @@ CHIP_ERROR result = idOptions.addTargetAppInfo(targetAppInfo); matter::casting::core::ConnectionCallbacks connectionCallbacks; connectionCallbacks.mOnConnectionComplete = ConnectionHandler; -// If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature commissioning flow: +// If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature: // Set the IdentificationDeclaration CommissionerPasscode flag to instruct the CastingPlayer / // Commissioner to use the Commissioner-generated Passcode for commissioning. Set the // CommissionerDeclarationCallback in ConnectionCallbacks. @@ -921,7 +921,7 @@ IdentificationDeclarationOptions idOptions = new IdentificationDeclarationOption TargetAppInfo targetAppInfo = new TargetAppInfo(DESIRED_TARGET_APP_VENDOR_ID); idOptions.addTargetAppInfo(targetAppInfo); -// If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature commissioning flow. +// If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature. // Set the IdentificationDeclaration CommissionerPasscode flag to instruct the CastingPlayer / // Commissioner to use the Commissioner-generated Passcode for commissioning. idOptions = new IdentificationDeclarationOptions(commissionerPasscode:true); @@ -959,7 +959,7 @@ ConnectionCallbacks connectionCallbacks = }); } }, - // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature commissioning flow. + // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature. // Define a callback to handle CastingPlayer’s CommissionerDeclaration messages. // This can be null if using Casting Client / Commissionee generated passcode commissioning. new MatterCallback() { @@ -1044,7 +1044,7 @@ func connect(selectedCastingPlayer: MCCastingPlayer?) { } } - // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature commissioning flow. + // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature. // Define a callback to handle CastingPlayer’s CommissionerDeclaration messages. let commissionerDeclarationCallback: (MCCommissionerDeclaration) -> Void = { commissionerDeclarationMessage in DispatchQueue.main.async { @@ -1119,7 +1119,7 @@ func connect(selectedCastingPlayer: MCCastingPlayer?) { ) identificationDeclarationOptions.addTargetAppInfo(targetAppInfo) - // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature commissioning flow. + // If using the alternate CastingPlayer / Commissioner-Generated Passcode UDC feature. // Set the IdentificationDeclaration CommissionerPasscode flag to instruct the CastingPlayer / // Commissioner to use the Commissioner-generated Passcode for commissioning. Set the // CommissionerDeclarationCallback in MCConnectionCallbacks. diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java index bb43165be6fcfb..b61b63f3e0785e 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java @@ -128,12 +128,13 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { () -> { Log.d(TAG, "onViewCreated() calling CastingPlayer.verifyOrEstablishConnection()"); - IdentificationDeclarationOptions idOptions = new IdentificationDeclarationOptions(); + IdentificationDeclarationOptions idOptions; TargetAppInfo targetAppInfo = new TargetAppInfo(DESIRED_TARGET_APP_VENDOR_ID); if (useCommissionerGeneratedPasscode) { - // Constructor to set only the commissionerPasscode. - idOptions = new IdentificationDeclarationOptions(true); + // Set commissionerPasscode to true for CastingPlayer/Commissioner-Generated + // passcode commissioning. + idOptions = new IdentificationDeclarationOptions(false, false, true, false, false); targetAppInfo = new TargetAppInfo(DESIRED_TARGET_APP_VENDOR_ID_FOR_CGP_FLOW); Log.d( TAG, @@ -142,6 +143,7 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + ", useCommissionerGeneratedPasscode: " + useCommissionerGeneratedPasscode); } else { + idOptions = new IdentificationDeclarationOptions(); Log.d( TAG, "onViewCreated() calling CastingPlayer.verifyOrEstablishConnection() Target Content Application Vendor ID: " diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java index 2539fe86b84a33..48c7acecae45d2 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java @@ -30,15 +30,6 @@ public class IdentificationDeclarationOptions { /** Default constructor. */ public IdentificationDeclarationOptions() {} - /** - * Constructor to set only the commissionerPasscode. - * - * @param commissionerPasscode the commissioner passcode flag. - */ - public IdentificationDeclarationOptions(boolean commissionerPasscode) { - this.commissionerPasscode = commissionerPasscode; - } - /** * Constructor to set all fields. *