Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadb-amazon committed May 7, 2024
1 parent 1608b41 commit fd5e865
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,27 @@ - (MCCastingPlayer * _Nonnull)castingPlayer
- (MCCluster * _Nullable)clusterForType:(MCEndpointClusterType)type
{
switch (type) {
case MCEndpointClusterTypeApplicationBasic:
return [[MCApplicationBasicCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster<matter::casting::clusters::application_basic::ApplicationBasicCluster>()];

case MCEndpointClusterTypeApplicationLauncher:
return [[MCApplicationLauncherCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster<matter::casting::clusters::application_launcher::ApplicationLauncherCluster>()];

case MCEndpointClusterTypeContentLauncher:
return [[MCContentLauncherCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster<matter::casting::clusters::content_launcher::ContentLauncherCluster>()];

case MCEndpointClusterTypeApplicationBasic:
return [[MCApplicationBasicCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster<matter::casting::clusters::application_basic::ApplicationBasicCluster>()];
case MCEndpointClusterTypeKeypadInput:
return [[MCKeypadInputCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster<matter::casting::clusters::keypad_input::KeypadInputCluster>()];

case MCEndpointClusterTypeMediaPlayback:
return [[MCMediaPlaybackCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster<matter::casting::clusters::media_playback::MediaPlaybackCluster>()];

case MCEndpointClusterTypeOnOff:
return [[MCOnOffCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster<matter::casting::clusters::on_off::OnOffCluster>()];

case MCEndpointClusterTypeTargetNavigator:
return [[MCTargetNavigatorCluster alloc] initWithCppCluster:_cppEndpoint->GetCluster<matter::casting::clusters::target_navigator::TargetNavigatorCluster>()];

default:
ChipLogError(AppServer, "MCEndpointClusterType not found");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -115,6 +115,6 @@ class MediaPlaybackViewModel: ObservableObject {
}
}
})
}*/
}
}
}

0 comments on commit fd5e865

Please sign in to comment.