bluetoothengine/btsac/src/btsacStateConfiguring.cpp
changeset 1 6a1fe72036e3
parent 0 f63038272f30
child 21 0ba996a9b75d
equal deleted inserted replaced
0:f63038272f30 1:6a1fe72036e3
    96 		{
    96 		{
    97 		Parent().iRemoteSEPs->SetState(info.SEID(), CBTSACStreamEndPoint::EDiscoveredRemote, &info);
    97 		Parent().iRemoteSEPs->SetState(info.SEID(), CBTSACStreamEndPoint::EDiscoveredRemote, &info);
    98 		}
    98 		}
    99 	else // internal problem
    99 	else // internal problem
   100 		{
   100 		{
   101   		CancelActionL(KErrCancel, EGavdpResetReasonGeneral);
   101   		CancelActionL(KErrCancel);
   102 		}
   102 		}
   103     }
   103     }
   104 
   104 
   105 // -----------------------------------------------------------------------------
   105 // -----------------------------------------------------------------------------
   106 // CBtsacConfiguring::CancelActionL
   106 // CBtsacConfiguring::CancelActionL
   107 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
   108 //
   108 //
   109 void CBtsacConfiguring::CancelActionL(TInt aError, TBTSACGavdpResetReason aGavdpReset)
   109 void CBtsacConfiguring::CancelActionL(TInt aError)
   110     {
   110     {
   111     TRACE_FUNC
   111     TRACE_FUNC
   112 	Parent().CompletePendingRequests((KConnectReq | KOpenAudioReq), aError);
   112 	Parent().CompletePendingRequests((KConnectReq | KOpenAudioReq), aError);
   113     Parent().ChangeStateL(CBtsacListening::NewL(Parent(), aGavdpReset, aError));
   113     Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
   114     }
   114     }
   115 
   115 
   116 // -----------------------------------------------------------------------------
   116 // -----------------------------------------------------------------------------
   117 // CBtsacConfiguring::CancelConnectL
   117 // CBtsacConfiguring::CancelConnectL
   118 // -----------------------------------------------------------------------------
   118 // -----------------------------------------------------------------------------
   119 //
   119 //
   120 void CBtsacConfiguring::CancelConnectL()
   120 void CBtsacConfiguring::CancelConnectL()
   121     {
   121     {
   122     TRACE_FUNC
   122     TRACE_FUNC
   123 	CancelActionL(KErrCancel, EGavdpResetReasonGeneral); // do no cancel till gavdp_error call back recieved
   123 	CancelActionL(KErrCancel);
   124     }
   124     }
   125 
   125 
   126 // -----------------------------------------------------------------------------
   126 // -----------------------------------------------------------------------------
   127 // CBtsacConfiguring::OpenAudioLinkL
   127 // CBtsacConfiguring::OpenAudioLinkL
   128 // -----------------------------------------------------------------------------
   128 // -----------------------------------------------------------------------------
   140 //
   140 //
   141 void CBtsacConfiguring::DisconnectL()	
   141 void CBtsacConfiguring::DisconnectL()	
   142 	{
   142 	{
   143 	TRACE_FUNC
   143 	TRACE_FUNC
   144 	Parent().CompletePendingRequests(KDisconnectReq, KErrNone);
   144 	Parent().CompletePendingRequests(KDisconnectReq, KErrNone);
   145 	CancelActionL(KErrCancel, EGavdpResetReasonGeneral);
   145 	CancelActionL(KErrCancel);
   146 	}	
   146 	}	
   147 
   147 
   148 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   149 // CBtsacConfiguring::GAVDP_BearerReady
   149 // CBtsacConfiguring::GAVDP_BearerReady
   150 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   196 		RPointerArray<TAvdtpServiceCapability> SEPCapabilities;
   196 		RPointerArray<TAvdtpServiceCapability> SEPCapabilities;
   197 	    if ((Parent().iRemoteSEPs->GetCaps(Parent().GetSEPIndex(), SEPCapabilities)) )
   197 	    if ((Parent().iRemoteSEPs->GetCaps(Parent().GetSEPIndex(), SEPCapabilities)) )
   198 			{
   198 			{
   199 			TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Couldn't retrieve Capabilities !")))
   199 			TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Couldn't retrieve Capabilities !")))
   200 		   	SEPCapabilities.Close();
   200 		   	SEPCapabilities.Close();
   201 		   	TRAPD(err, CancelActionL(KErrCancel, EGavdpResetReasonGeneral));
   201 		   	TRAPD(err, CancelActionL(KErrCancel));
   202 		   	if(err)
   202 		   	if(err)
   203 		   		{
   203 		   		{
   204 		   		return KErrNoMemory;
   204 		   		return KErrNoMemory;
   205 		   		}
   205 		   		}
   206 			return KErrGeneral; 
   206 			return KErrGeneral; 
   222 				{
   222 				{
   223 				MedTransCaps = static_cast<TAvdtpMediaTransportCapabilities&>(*cap);
   223 				MedTransCaps = static_cast<TAvdtpMediaTransportCapabilities&>(*cap);
   224 				TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Media Transport Caps retrieved.")))
   224 				TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Media Transport Caps retrieved.")))
   225 				}
   225 				}
   226 	   		}
   226 	   		}
   227 	   	SEPCapabilities.Close();
   227 	   	SEPCapabilities.Close();	
   228 		
       
   229 		//Parent().StoreAccInfo();  // stores iRemoteSEPs (SEPManager) into database
       
   230 		
   228 		
   231 		// Check if headset's capabilities suits us			
   229 		// Check if headset's capabilities suits us			
   232 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Sampling Frequencies: %d"), SBCCaps.SamplingFrequencies()))
   230 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Sampling Frequencies: %d"), SBCCaps.SamplingFrequencies()))
   233 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Channel modes: %d"), SBCCaps.ChannelModes()))
   231 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Channel modes: %d"), SBCCaps.ChannelModes()))
   234 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Blocks: %d"), SBCCaps.BlockLengths()))
   232 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Blocks: %d"), SBCCaps.BlockLengths()))
   237 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Max bitpool: %d"), SBCCaps.MaxBitpoolValue()))
   235 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Max bitpool: %d"), SBCCaps.MaxBitpoolValue()))
   238 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Min bitpool: %d"), SBCCaps.MinBitpoolValue()))
   236 		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Accessory Min bitpool: %d"), SBCCaps.MinBitpoolValue()))
   239 		if (Parent().iStreamer->ConfigureSEP(SBCCaps) )
   237 		if (Parent().iStreamer->ConfigureSEP(SBCCaps) )
   240 			{
   238 			{
   241 	   		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Streamer couldn't configure SEP !")))
   239 	   		TRACE_INFO((_L("CBtsacConfiguring::GAVDP_ConfigurationEndIndication() Streamer couldn't configure SEP !")))
   242 	        TRAPD(err, CancelActionL(KErrCancel, EGavdpResetReasonGeneral));
   240 	        TRAPD(err, CancelActionL(KErrCancel));
   243 	        if(err)
   241 	        if(err)
   244 	        	{
   242 	        	{
   245 	        	return KErrNoMemory;
   243 	        	return KErrNoMemory;
   246 	        	}
   244 	        	}
   247 	        return KErrGeneral;   // capabilites doesn't suit us
   245 	        return KErrGeneral;   // capabilites doesn't suit us
   290 		{
   288 		{
   291 		case KErrAvdtpRequestTimeout: // -18005
   289 		case KErrAvdtpRequestTimeout: // -18005
   292 			{
   290 			{
   293 			TRACE_INFO((_L("CBtsacConfiguring::HandleGavdpErrorL() Request TIMEOUT")))
   291 			TRACE_INFO((_L("CBtsacConfiguring::HandleGavdpErrorL() Request TIMEOUT")))
   294 			// Go to listening state, gavdp will be shutdown in listening state
   292 			// Go to listening state, gavdp will be shutdown in listening state
   295 			CancelActionL(KErrDisconnected, EGavdpResetReasonNone);
   293 			CancelActionL(KErrDisconnected);
   296 			break;
   294 			break;
   297 			}
   295 			}
   298 			
   296 			
   299 		case KErrHCILinkDisconnection: // -6305
   297 		case KErrHCILinkDisconnection: // -6305
   300 		case KErrDisconnected: // -36
   298 		case KErrDisconnected: // -36
   301 			{
   299 			{
   302 			TRACE_INFO((_L("CBtsacConfiguring::HandleGavdpErrorL() Signalling disconnected.")))
   300 			TRACE_INFO((_L("CBtsacConfiguring::HandleGavdpErrorL() Signalling disconnected.")))
   303 			// for both outgoing or incoming connection, if we have an error, 
   301 			// for both outgoing or incoming connection, if we have an error, 
   304 			// this means there is disconnection
   302 			// this means there is disconnection
   305 			CancelActionL(aError, EGavdpResetReasonNone);
   303 			CancelActionL(aError);
   306 			break;
   304 			break;
   307 			}
   305 			}
   308 		
   306 		
   309 		default:			
   307 		default:			
   310 		//case KErrNotReady: // -18
   308 		//case KErrNotReady: // -18
   311 		//case KErrInUse: // -14
   309 		//case KErrInUse: // -14
   312 			{
   310 			{
   313 			CancelActionL(KErrDisconnected, EGavdpResetReasonGeneral);
   311 			CancelActionL(KErrDisconnected);
   314 			break;
   312 			break;
   315 			}
   313 			}
   316 		}
   314 		}
   317 	}
   315 	}
   318     
   316