bluetooth/btstack/avdtp/avdtpMuxChannel.cpp
branchRCL_3
changeset 22 786b94c6f0a4
parent 0 29b1cd4cb562
equal deleted inserted replaced
21:14e240312f6f 22:786b94c6f0a4
   293 	{
   293 	{
   294 	// put on pool and notify
   294 	// put on pool and notify
   295 	#pragma message("is there n pools for eg media, or just one?")
   295 	#pragma message("is there n pools for eg media, or just one?")
   296 	}
   296 	}
   297 */	
   297 */	
   298 TInt CMuxChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType)
   298 TInt CMuxChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority)
   299 /**
   299 /**
   300 Protocol must ensure it has found appropriate muxchannel for
   300 Protocol must ensure it has found appropriate muxchannel for
   301 Recovery packets
   301 Recovery packets
   302 */
   302 */
   303 	{
   303 	{
   319 		break;
   319 		break;
   320 		}
   320 		}
   321 	
   321 	
   322 	__ASSERT_DEBUG(sessionArray, Panic(EAVDTPBadSessionAttachToTransportChannel));
   322 	__ASSERT_DEBUG(sessionArray, Panic(EAVDTPBadSessionAttachToTransportChannel));
   323 	
   323 	
   324 	return sessionArray->Append(TUserPlaneTransportSessionState(aSession));
   324 	TInt err = sessionArray->Append(TUserPlaneTransportSessionState(aSession, aPriority));
       
   325 	if(err == KErrNone)
       
   326 		{
       
   327 		UpdateChannelPriority();
       
   328 		}
       
   329 	return err;
       
   330 	}
       
   331 
       
   332 void CMuxChannel::UpdateChannelPriority()
       
   333 	{
       
   334 	LOG_FUNC
       
   335 	
       
   336 	TL2CapConfig::TChannelPriority maxPriority = TL2CapConfig::ELow;
       
   337 	
       
   338 	MaxChannelPriority(maxPriority, iMediaSessions);
       
   339 	MaxChannelPriority(maxPriority, iReportingSessions);
       
   340 	MaxChannelPriority(maxPriority, iRecoverySessions);
       
   341 	
       
   342 	if(iLogicalChannel)
       
   343 		{
       
   344 		TPckgBuf<TL2CapConfig> configBuf;
       
   345 		configBuf().ConfigureChannelPriority(maxPriority);
       
   346 		(void)iLogicalChannel->SetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf);
       
   347 		}
       
   348 	}
       
   349 
       
   350 
       
   351 void CMuxChannel::MaxChannelPriority(TL2CapConfig::TChannelPriority& aMaxPriority, const RArray<TUserPlaneTransportSessionState>& aSessions)
       
   352 	{
       
   353 	LOG_STATIC_FUNC
       
   354 	
       
   355 	for(TInt i=0; i < aSessions.Count(); ++i)
       
   356 		{
       
   357 		TL2CapConfig::TChannelPriority priority = aSessions[i].iChannelPriority;
       
   358 		if(aMaxPriority < priority)
       
   359 			{
       
   360 			aMaxPriority = priority;
       
   361 			}
       
   362 		}
   325 	}
   363 	}
   326 
   364 
   327 /**
   365 /**
   328 Actually activate multiplexing mode in packet domain
   366 Actually activate multiplexing mode in packet domain
   329 - we are either multiplexing for one session, or many and should expect and generate
   367 - we are either multiplexing for one session, or many and should expect and generate
   417 #endif
   455 #endif
   418 			}
   456 			}
   419 		}
   457 		}
   420 	__ASSERT_DEBUG(found==1, Panic(EAVDTPBadSessionDetachFromTransportChannel));
   458 	__ASSERT_DEBUG(found==1, Panic(EAVDTPBadSessionDetachFromTransportChannel));
   421 
   459 
       
   460 	UpdateChannelPriority();
   422 	CheckForClose();
   461 	CheckForClose();
   423 	}
   462 	}
   424 
   463 
   425 CServProviderBase* CMuxChannel::ObtainSAP()
   464 CServProviderBase* CMuxChannel::ObtainSAP()
   426 	{
   465 	{