bluetoothengine/btsac/src/btsacStateStreaming.cpp
changeset 45 b0aebde9b1fb
parent 1 6a1fe72036e3
equal deleted inserted replaced
44:6d10bd0d821a 45:b0aebde9b1fb
     1 /*
     1 /*
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    97 	if ( ret )
    97 	if ( ret )
    98 		{
    98 		{
    99 		TRACE_INFO((_L("CBtsacStreaming::Cancel() iStreamer.StopStream() returned error(%d) !!!"), ret))
    99 		TRACE_INFO((_L("CBtsacStreaming::Cancel() iStreamer.StopStream() returned error(%d) !!!"), ret))
   100 		}
   100 		}
   101 	Parent().CompletePendingRequests(KCompleteAllReqs, aError);
   101 	Parent().CompletePendingRequests(KCompleteAllReqs, aError);
   102 	Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
   102 	Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
   103 	}
   103 	}
   104 
   104 
   105 // -----------------------------------------------------------------------------
   105 // -----------------------------------------------------------------------------
   106 // CBtsacStreaming::OpenAudioLinkL
   106 // CBtsacStreaming::OpenAudioLinkL
   107 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
   149 void CBtsacStreaming::CancelCloseAudioLink(const TBTDevAddr& /*aAddr*/)
   149 void CBtsacStreaming::CancelCloseAudioLink(const TBTDevAddr& /*aAddr*/)
   150 	{
   150 	{
   151 	TRACE_FUNC
   151 	TRACE_FUNC
   152 	// For safety sake complete all pending requests
   152 	// For safety sake complete all pending requests
   153 	Parent().CompletePendingRequests(KCompleteAllReqs, KErrNone);
   153 	Parent().CompletePendingRequests(KCompleteAllReqs, KErrNone);
   154 	TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected)));
   154 	TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected)));
   155 	}
   155 	}
   156 
   156 
   157 
   157 
   158 // -----------------------------------------------------------------------------
   158 // -----------------------------------------------------------------------------
   159 // CBtsacStreaming::StartRecording
   159 // CBtsacStreaming::StartRecording
   169 		TInt err = Parent().AbortStream();
   169 		TInt err = Parent().AbortStream();
   170 		if(err)
   170 		if(err)
   171 			{
   171 			{
   172 			TRACE_INFO((_L("CBtsacStreaming::StartRecording() Couldn't abort stream.")))	
   172 			TRACE_INFO((_L("CBtsacStreaming::StartRecording() Couldn't abort stream.")))	
   173 			}
   173 			}
   174 		TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected)));
   174 		TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected)));
   175 	 	}
   175 	 	}
   176 	}
   176 	}
   177 
   177 
   178 // -----------------------------------------------------------------------------
   178 // -----------------------------------------------------------------------------
   179 // CBtsacStreaming::DisconnectL
   179 // CBtsacStreaming::DisconnectL
   186 	if ( ret )
   186 	if ( ret )
   187 		{
   187 		{
   188 		TRACE_INFO((_L("CBtsacStreaming::DisconnectL() StopStream() returned error: %d"), ret))	
   188 		TRACE_INFO((_L("CBtsacStreaming::DisconnectL() StopStream() returned error: %d"), ret))	
   189 		}
   189 		}
   190 	Parent().CompletePendingRequests(KDisconnectReq, ret);
   190 	Parent().CompletePendingRequests(KDisconnectReq, ret);
   191 	Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrNone));
   191 	Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrNone));
   192 	}
   192 	}
   193 
   193 
   194 // -----------------------------------------------------------------------------
   194 // -----------------------------------------------------------------------------
   195 // CBtsacStreaming::GAVDP_SuspendStreamsConfirm
   195 // CBtsacStreaming::GAVDP_SuspendStreamsConfirm
   196 // -----------------------------------------------------------------------------
   196 // -----------------------------------------------------------------------------
   218 		TRACE_INFO((_L("CBtsacStreaming::Cancel() iStreamer.StopStream() returned error(%d) !!!"), ret))
   218 		TRACE_INFO((_L("CBtsacStreaming::Cancel() iStreamer.StopStream() returned error(%d) !!!"), ret))
   219 		}
   219 		}
   220 	
   220 	
   221 	// It is possible the remote disconnected while we have active close audio request.
   221 	// It is possible the remote disconnected while we have active close audio request.
   222 	Parent().CompletePendingRequests(KCompleteAllReqs, KErrNone);
   222 	Parent().CompletePendingRequests(KCompleteAllReqs, KErrNone);
   223     TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected)));
   223     TRAP_IGNORE(Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected)));
   224 	}
   224 	}
   225 
   225 
   226 // -----------------------------------------------------------------------------
   226 // -----------------------------------------------------------------------------
   227 // CBtsacStreaming::GAVDP_ReleaseIndication
   227 // CBtsacStreaming::GAVDP_ReleaseIndication
   228 // -----------------------------------------------------------------------------
   228 // -----------------------------------------------------------------------------
   337 				Parent().ChangeStateL(CBtsacAborting::NewL(Parent()));
   337 				Parent().ChangeStateL(CBtsacAborting::NewL(Parent()));
   338 				}
   338 				}
   339 			else
   339 			else
   340 				{
   340 				{
   341 				Parent().CompletePendingRequests(KCompleteAllReqs, aError);
   341 				Parent().CompletePendingRequests(KCompleteAllReqs, aError);
   342 				Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected));
   342 				Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected));
   343 				}
   343 				}
   344 			break;
   344 			break;
   345 			}
   345 			}
   346 		case KErrHCILinkDisconnection: // -6305
   346 		case KErrHCILinkDisconnection: // -6305
   347 		case KErrDisconnected: // -36
   347 		case KErrDisconnected: // -36
   348 			{
   348 			{
   349 			Parent().CompletePendingRequests(KCompleteAllReqs, aError);
   349 			Parent().CompletePendingRequests(KCompleteAllReqs, aError);
   350 			Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, aError));
   350 			Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, aError));
   351 			break;
   351 			break;
   352 			}
   352 			}
   353 		default:
   353 		default:
   354 			{
   354 			{
   355 			// Unknown error. For safety's sake let's disconnect a2dp link and inform btaudioman
   355 			// Unknown error. For safety's sake let's disconnect a2dp link and inform btaudioman
   356 			TRACE_INFO((_L("CBtsacStreaming::HandleGavdpErrorL() Unknown error, goes to listening")))
   356 			TRACE_INFO((_L("CBtsacStreaming::HandleGavdpErrorL() Unknown error, goes to listening")))
   357 			Parent().CompletePendingRequests(KCompleteAllReqs, aError);
   357 			Parent().CompletePendingRequests(KCompleteAllReqs, aError);
   358 			Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EGavdpResetReasonGeneral, KErrDisconnected));
   358 			Parent().ChangeStateL(CBtsacListening::NewL(Parent(), EResetGavdp, KErrDisconnected));
   359 			break;
   359 			break;
   360 			}
   360 			}
   361 		}
   361 		}
   362 	}
   362 	}
   363 	
   363