diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdDiscoveryListener.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdDiscoveryListener.java index b0644c456cabe9..5fda64cbbba8ef 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdDiscoveryListener.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdDiscoveryListener.java @@ -22,6 +22,8 @@ import android.util.Log; import chip.platform.NsdManagerServiceResolver; import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class NsdDiscoveryListener implements NsdManager.DiscoveryListener { private static final String TAG = NsdDiscoveryListener.class.getSimpleName(); @@ -33,6 +35,7 @@ public class NsdDiscoveryListener implements NsdManager.DiscoveryListener { private final SuccessCallback successCallback; private final FailureCallback failureCallback; private final NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState; + private final ExecutorService resolutionExecutor; public NsdDiscoveryListener( NsdManager nsdManager, @@ -49,6 +52,7 @@ public NsdDiscoveryListener( this.successCallback = successCallback; this.failureCallback = failureCallback; this.nsdManagerResolverAvailState = nsdManagerResolverAvailState; + this.resolutionExecutor = Executors.newSingleThreadExecutor(); } @Override @@ -58,24 +62,32 @@ public void onDiscoveryStarted(String regType) { @Override public void onServiceFound(NsdServiceInfo service) { - Log.d(TAG, "Service discovery success. " + service); - if (service.getServiceType().equals(targetServiceType)) { - if (nsdManagerResolverAvailState != null) { - nsdManagerResolverAvailState.acquireResolver(); - } - nsdManager.resolveService( - service, - new NsdResolveListener( - nsdManager, - deviceTypeFilter, - preCommissionedVideoPlayers, - successCallback, - failureCallback, - nsdManagerResolverAvailState, - 1)); - } else { - Log.d(TAG, "Ignoring discovered service: " + service.toString()); - } + this.resolutionExecutor.execute( + new Runnable() { + @Override + public void run() { + Log.d(TAG, "Service discovery success. " + service); + if (service.getServiceType().equals(targetServiceType)) { + if (nsdManagerResolverAvailState != null) { + nsdManagerResolverAvailState.acquireResolver(); + } + + Log.d(TAG, "Calling NsdManager.resolveService for " + service); + nsdManager.resolveService( + service, + new NsdResolveListener( + nsdManager, + deviceTypeFilter, + preCommissionedVideoPlayers, + successCallback, + failureCallback, + nsdManagerResolverAvailState, + 1)); + } else { + Log.d(TAG, "Ignoring discovered service: " + service.toString()); + } + } + }); } @Override diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionableDataProviderImpl.hpp b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionableDataProviderImpl.hpp index 872feb587837d3..b05ce4aa89a4ef 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionableDataProviderImpl.hpp +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionableDataProviderImpl.hpp @@ -74,7 +74,7 @@ class CommissionableDataProviderImpl : public CommissionableDataProvider CHIP_ERROR GetSpake2pIterationCount(uint32_t & iterationCount) override { - if (mSetupDiscriminator > 0) + if (mSpake2pIterationCount > 0) { iterationCount = mSpake2pIterationCount; } diff --git a/examples/tv-casting-app/darwin/TvCasting/TvCasting.xcodeproj/project.pbxproj b/examples/tv-casting-app/darwin/TvCasting/TvCasting.xcodeproj/project.pbxproj index dfaf0a6813066d..6252d2cb145612 100644 --- a/examples/tv-casting-app/darwin/TvCasting/TvCasting.xcodeproj/project.pbxproj +++ b/examples/tv-casting-app/darwin/TvCasting/TvCasting.xcodeproj/project.pbxproj @@ -420,7 +420,7 @@ CoreData, "-Wl,-unexported_symbol,\"__Z*\"", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.matter.TvCasting-sharadb"; + PRODUCT_BUNDLE_IDENTIFIER = com.matter.TvCasting; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -467,7 +467,7 @@ "-Wformat-nonliteral", "-Wformat-security", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.matter.TvCasting-sharadb"; + PRODUCT_BUNDLE_IDENTIFIER = com.matter.TvCasting; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/examples/tv-casting-app/darwin/TvCasting/TvCasting/TvCastingApp.swift b/examples/tv-casting-app/darwin/TvCasting/TvCasting/TvCastingApp.swift index 26e4768485d13e..daef2e730d5e3a 100644 --- a/examples/tv-casting-app/darwin/TvCasting/TvCasting/TvCastingApp.swift +++ b/examples/tv-casting-app/darwin/TvCasting/TvCasting/TvCastingApp.swift @@ -38,6 +38,12 @@ struct TvCastingApp: App { } appParameters.rotatingDeviceIdUniqueId = Data(rotatingDeviceIdUniqueId) + let onboardingParameters: OnboardingPayload = OnboardingPayload() + onboardingParameters.setupPasscode = 20202021 + onboardingParameters.setupDiscriminator = 3840 + + appParameters.onboardingPayload = onboardingParameters + castingServerBridge.initApp(appParameters, clientQueue: DispatchQueue.main, initAppStatusHandler: { (result: Bool) -> () in self.Log.info("initApp result \(result)") })