Skip to content

Commit

Permalink
Addressed comments by sharadb-amazon2
Browse files Browse the repository at this point in the history
  • Loading branch information
pgregorr-amazon committed Jun 28, 2024
1 parent 76c1f5f commit c0bc80e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
16 changes: 8 additions & 8 deletions examples/tv-casting-app/APIs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<CommissionerDeclaration>() {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit c0bc80e

Please sign in to comment.