diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCEndpoint.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCEndpoint.mm index e06ce0394261e7..76d1eaf70724f9 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCEndpoint.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCEndpoint.mm @@ -90,15 +90,27 @@ - (MCCastingPlayer * _Nonnull)castingPlayer - (MCCluster * _Nullable)clusterForType:(MCEndpointClusterType)type { switch (type) { + case MCEndpointClusterTypeApplicationBasic: + return [[MCApplicationBasicCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster()]; + + case MCEndpointClusterTypeApplicationLauncher: + return [[MCApplicationLauncherCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster()]; + case MCEndpointClusterTypeContentLauncher: return [[MCContentLauncherCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster()]; - case MCEndpointClusterTypeApplicationBasic: - return [[MCApplicationBasicCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster()]; + case MCEndpointClusterTypeKeypadInput: + return [[MCKeypadInputCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster()]; case MCEndpointClusterTypeMediaPlayback: return [[MCMediaPlaybackCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster()]; + case MCEndpointClusterTypeOnOff: + return [[MCOnOffCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster()]; + + case MCEndpointClusterTypeTargetNavigator: + return [[MCTargetNavigatorCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster()]; + default: ChipLogError(AppServer, "MCEndpointClusterType not found"); break; diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/compat-shim/CastingServerBridge.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/compat-shim/CastingServerBridge.mm index caa161c4635ac1..565d5ffd6834f9 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/compat-shim/CastingServerBridge.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/compat-shim/CastingServerBridge.mm @@ -76,7 +76,7 @@ + (MCCluster * _Nullable)getClusterWith:(MCEndpointClusterType)type contentApp:( }]].firstObject; VerifyOrReturnValue(endpoint != nil, nil, ChipLogError(AppServer, "CastingServerBridge.clusterForType endpoint with ID: %d not found", contentApp.endpointId)); - return [endpoint clusterForType:MCEndpointClusterTypeContentLauncher]; + return [endpoint clusterForType:type]; } - (MatterError *)initializeApp:(AppParameters * _Nullable)appParameters @@ -225,6 +225,10 @@ - (void)sendUserDirectedCommissioningRequest:(DiscoveredNodeData * _Nonnull)comm [commissioner.getCastingPlayer verifyOrEstablishConnectionWithCompletionBlock:^(NSError * _Nullable err) { dispatch_async(clientQueue, ^{ if (err == nil) { + if (self->_commissioningCallbackHandlers != nil && self->_commissioningCallbackHandlers.commissioningCompleteCallback != nil) { + self->_commissioningCallbackHandlers.commissioningCompleteCallback(MATTER_NO_ERROR); + } + MCCastingPlayer * castingPlayer = [MCCastingPlayer getTargetCastingPlayer]; if (self->_onConnectionSuccessCallback != nil) { self->_onConnectionSuccessCallback([[VideoPlayer alloc] initWithCastingPlayer:castingPlayer]); @@ -252,7 +256,9 @@ - (void)getActiveTargetVideoPlayers:(dispatch_queue_t _Nonnull)clientQueue NSMutableArray * videoPlayers = [NSMutableArray new]; MCCastingPlayer * castingPlayer = [MCCastingPlayer getTargetCastingPlayer]; if (castingPlayer != nil) { - videoPlayers[0] = [[VideoPlayer alloc] initWithCastingPlayer:castingPlayer]; + VideoPlayer * videoPlayer = [[VideoPlayer alloc] initWithCastingPlayer:castingPlayer]; + videoPlayer.isConnected = true; + videoPlayers[0] = videoPlayer; } dispatch_async(clientQueue, ^{ activeTargetVideoPlayersHandler(videoPlayers); diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/compat-shim/VideoPlayer.m b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/compat-shim/VideoPlayer.m index 2dab3588756643..94f432a27197ed 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/compat-shim/VideoPlayer.m +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/compat-shim/VideoPlayer.m @@ -88,7 +88,6 @@ - (instancetype)initWithCastingPlayer:(MCCastingPlayer *)castingPlayer for (MCEndpoint * endpoint in endpoints) { [_contentApps addObject:[[ContentApp alloc] initWithEndpoint:endpoint]]; } - _isConnected = false; // this will make the compat shim call the openBasicCommissioningWindow API _isInitialized = true; } return self; diff --git a/examples/tv-casting-app/darwin/TvCasting/TvCasting/compat/MediaPlaybackViewModel.swift b/examples/tv-casting-app/darwin/TvCasting/TvCasting/compat/MediaPlaybackViewModel.swift index 1c11f812017017..d6352b29b1b920 100644 --- a/examples/tv-casting-app/darwin/TvCasting/TvCasting/compat/MediaPlaybackViewModel.swift +++ b/examples/tv-casting-app/darwin/TvCasting/TvCasting/compat/MediaPlaybackViewModel.swift @@ -98,7 +98,7 @@ class MediaPlaybackViewModel: ObservableObject { func populateContentApps() { - /*if let castingServerBridge = CastingServerBridge.getSharedInstance() + if let castingServerBridge = CastingServerBridge.getSharedInstance() { castingServerBridge.getActiveTargetVideoPlayers(DispatchQueue.main, activeTargetVideoPlayersHandler: { (targetVideoPlayers: NSMutableArray?) -> () in @@ -115,6 +115,6 @@ class MediaPlaybackViewModel: ObservableObject { } } }) - }*/ + } } }