bluetooth/btstack/avdtp/avdtpStreamStates.cpp
branchRCL_3
changeset 56 015fa7494bd2
parent 41 786b94c6f0a4
equal deleted inserted replaced
49:10183c6d2913 56:015fa7494bd2
   252 	}	
   252 	}	
   253 	
   253 	
   254 TInt TAVStreamState::AddSession(CAVStream& /*aStream*/, 
   254 TInt TAVStreamState::AddSession(CAVStream& /*aStream*/, 
   255 							TAvdtpTransportSessionType /*aType*/,
   255 							TAvdtpTransportSessionType /*aType*/,
   256 							CUserPlaneTransportSession& /*aSession*/,
   256 							CUserPlaneTransportSession& /*aSession*/,
   257 							CTransportChannel*& /*aTransportChannel*/,
   257 							CTransportChannel*& /*aTransportChannel*/) const
   258 							TL2CapConfig::TChannelPriority /*aPriority*/) const
       
   259 	{
   258 	{
   260 	LOG_FUNC
   259 	LOG_FUNC
   261 	DEBUGPANICINSTATE(EAvdtpUnexpectedAddSessionEvent);
   260 	DEBUGPANICINSTATE(EAvdtpUnexpectedAddSessionEvent);
   262 	return KErrNotReady;
   261 	return KErrNotReady;
   263 	}
   262 	}
   489 Once all the required sessions are added the stream tries to open the remote
   488 Once all the required sessions are added the stream tries to open the remote
   490 */
   489 */
   491 TInt TAVStreamStateINTConfigured::AddSession(CAVStream& aStream,
   490 TInt TAVStreamStateINTConfigured::AddSession(CAVStream& aStream,
   492 									TAvdtpTransportSessionType aType,
   491 									TAvdtpTransportSessionType aType,
   493 						   			CUserPlaneTransportSession& aSession,
   492 						   			CUserPlaneTransportSession& aSession,
   494 						   			CTransportChannel*& aChannel,
   493 						   			CTransportChannel*& aChannel) const
   495 						   			TL2CapConfig::TChannelPriority aPriority) const
       
   496 	{
   494 	{
   497 	LOG_FUNC
   495 	LOG_FUNC
   498 	TInt ret = KErrNone;
   496 	TInt ret = KErrNone;
   499 	// check GAVDP isn't being naughty and asking for an unconfigured session
   497 	// check GAVDP isn't being naughty and asking for an unconfigured session
   500 	if ((aType==EReporting && !aStream.CheckConfigured(EServiceCategoryReporting))
   498 	if ((aType==EReporting && !aStream.CheckConfigured(EServiceCategoryReporting))
   513 		aChannel = aStream.iProtocol.GetTransportChannel(aStream.iRemoteAddress, useMux);
   511 		aChannel = aStream.iProtocol.GetTransportChannel(aStream.iRemoteAddress, useMux);
   514 		
   512 		
   515 		if (aChannel)
   513 		if (aChannel)
   516 			{
   514 			{
   517 			// bind session to channel
   515 			// bind session to channel
   518 			ret = aChannel->AttachTransportSession(aSession, aType, aPriority);
   516 			ret = aChannel->AttachTransportSession(aSession, aType);
   519 			if (ret==KErrNone)
   517 			if (ret==KErrNone)
   520 				{
   518 				{
   521 				// keep a copy of this binding
   519 				// keep a copy of this binding
   522 				TTransportBinding binding;
   520 				TTransportBinding binding;
   523 				binding.iSession = &aSession;
   521 				binding.iSession = &aSession;
   774 	}
   772 	}
   775 	
   773 	
   776 TInt TAVStreamStateACPConfigured::AddSession(CAVStream& /*aStream*/, 
   774 TInt TAVStreamStateACPConfigured::AddSession(CAVStream& /*aStream*/, 
   777 							TAvdtpTransportSessionType /*aType*/,
   775 							TAvdtpTransportSessionType /*aType*/,
   778 							CUserPlaneTransportSession& /*aSession*/,
   776 							CUserPlaneTransportSession& /*aSession*/,
   779 							CTransportChannel*& /*aTransportChannel*/,
   777 							CTransportChannel*& /*aTransportChannel*/) const
   780 							TL2CapConfig::TChannelPriority /*aPriority*/) const
       
   781 	{
   778 	{
   782 	LOG_FUNC
   779 	LOG_FUNC
   783 	return KErrNotReady;
   780 	return KErrNotReady;
   784 	}
   781 	}
   785 
   782 
   829 	}
   826 	}
   830 
   827 
   831 TInt TAVStreamStateReady::AddSession(CAVStream& /*aStream*/, 
   828 TInt TAVStreamStateReady::AddSession(CAVStream& /*aStream*/, 
   832 		TAvdtpTransportSessionType /*aType*/,
   829 		TAvdtpTransportSessionType /*aType*/,
   833 		CUserPlaneTransportSession& /*aSession*/,
   830 		CUserPlaneTransportSession& /*aSession*/,
   834 		CTransportChannel*& /*aTransportChannel*/,
   831 		CTransportChannel*& /*aTransportChannel*/) const
   835 		TL2CapConfig::TChannelPriority /*aPriority*/) const
       
   836 {
   832 {
   837 LOG_FUNC
   833 LOG_FUNC
   838 #ifdef _DEBUG
   834 #ifdef _DEBUG
   839 return KErrPanicAvdtpOpenInBadState;
   835 return KErrPanicAvdtpOpenInBadState;
   840 #else
   836 #else
   921 		if (sigch)
   917 		if (sigch)
   922 			{
   918 			{
   923 			sigch->SendAbort(aStream, aStream.RemoteSEID());
   919 			sigch->SendAbort(aStream, aStream.RemoteSEID());
   924 			}
   920 			}
   925 	
   921 	
       
   922 		// no need to tell signalling session as Opening is not available to RGavdp
   926 		// Opening is performed when the necessary sockets are created and connected in a stream
   923 		// Opening is performed when the necessary sockets are created and connected in a stream
   927 		aStream.NotifyUserPlaneTransportSessionsError(NULL, aResult);
   924 		aStream.NotifyUserPlaneTransportSessionsError(NULL, aResult);
   928 		}
   925 		}
   929 	else
   926 	else
   930 		{
   927 		{
  1195 to come in and connect to the TCs.  The sessions do so at the behest of GAVDP
  1192 to come in and connect to the TCs.  The sessions do so at the behest of GAVDP
  1196 */
  1193 */
  1197 TInt TAVStreamStateWaitForSessions::AddSession(CAVStream& aStream,
  1194 TInt TAVStreamStateWaitForSessions::AddSession(CAVStream& aStream,
  1198 									TAvdtpTransportSessionType aType,
  1195 									TAvdtpTransportSessionType aType,
  1199 						   			CUserPlaneTransportSession& aSession,
  1196 						   			CUserPlaneTransportSession& aSession,
  1200 						   			CTransportChannel*& aChannel,
  1197 						   			CTransportChannel*& aChannel) const
  1201 						   			TL2CapConfig::TChannelPriority aPriority) const
       
  1202 	{
  1198 	{
  1203 	LOG_FUNC
  1199 	LOG_FUNC
  1204 	TInt ret = KErrNone;
  1200 	TInt ret = KErrNone;
  1205 
  1201 
  1206 	// bind session to channel - the channel is there, we'd have been told if it had gone
  1202 	// bind session to channel - the channel is there, we'd have been told if it had gone
  1239 			PanicInState(EAvdtpBadSessionAttachingToStream);
  1235 			PanicInState(EAvdtpBadSessionAttachingToStream);
  1240 		}
  1236 		}
  1241 	
  1237 	
  1242 	if (ret == KErrNone)
  1238 	if (ret == KErrNone)
  1243 		{
  1239 		{
  1244 		ret = b->iChannel->AttachTransportSession(aSession, aType, aPriority);
  1240 		ret = b->iChannel->AttachTransportSession(aSession, aType);
  1245 		if (ret==KErrNone)
  1241 		if (ret==KErrNone)
  1246 			{
  1242 			{
  1247 			// stream needs to remember binding
  1243 			// stream needs to remember binding
  1248 			b->iSession = &aSession;
  1244 			b->iSession = &aSession;
  1249 			// and session need to know channel
  1245 			// and session need to know channel
  1279 stored in the CAVStream object will be used to pass a start indication to GAVDP.
  1275 stored in the CAVStream object will be used to pass a start indication to GAVDP.
  1280 */
  1276 */
  1281 TInt TAVStreamStateWaitForSessionsStartReceived::AddSession(CAVStream& aStream,
  1277 TInt TAVStreamStateWaitForSessionsStartReceived::AddSession(CAVStream& aStream,
  1282 												TAvdtpTransportSessionType aType,
  1278 												TAvdtpTransportSessionType aType,
  1283 						   						CUserPlaneTransportSession& aSession,
  1279 						   						CUserPlaneTransportSession& aSession,
  1284 						   						CTransportChannel*& aChannel,
  1280 						   						CTransportChannel*& aChannel) const
  1285 						   						TL2CapConfig::TChannelPriority aPriority) const
       
  1286 	{
  1281 	{
  1287 	LOG_FUNC
  1282 	LOG_FUNC
  1288 	// Call the function from the parent class to bind the session
  1283 	// Call the function from the parent class to bind the session
  1289 	TInt ret = TAVStreamStateWaitForSessions::AddSession(aStream,aType,aSession,aChannel, aPriority);
  1284 	TInt ret = TAVStreamStateWaitForSessions::AddSession(aStream,aType,aSession,aChannel);
  1290 	
  1285 	
  1291 	// if that worked, and all the channels are bound, we can now issue the delayed start
  1286 	// if that worked, and all the channels are bound, we can now issue the delayed start
  1292 	if((ret == KErrNone) && (!aStream.iNumSessionsRequired))
  1287 	if((ret == KErrNone) && (!aStream.iNumSessionsRequired))
  1293 		{
  1288 		{
  1294 		aStream.ReadyForStartIndication();
  1289 		aStream.ReadyForStartIndication();