telephonyserverplugins/multimodetsy/hayes/ATHANGUP.CPP
changeset 0 3553901f7fa8
child 19 630d2f34d719
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Hang Up Command
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <commsdattypesv1_1.h>
       
    19 #include <cdblen.h>
       
    20 #include "ATHANGUP.H"
       
    21 #include "mSLOGGER.H"
       
    22 #include "PHONE.H"
       
    23 #include "CALL.H"
       
    24 #include "ATNOCARR.H"
       
    25 #include "NOTIFY.H"
       
    26 #include "ATIO.H"
       
    27 
       
    28 const TInt KTimeOut=3;		// seconds
       
    29 
       
    30 //
       
    31 // CATHangUpVoice
       
    32 //
       
    33 CATHangUpVoice* CATHangUpVoice::NewL(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
    34 	{
       
    35 	CATHangUpVoice* hangup=new(ELeave) CATHangUpVoice(aIo, aTelObject, aInit, aPhoneGlobals);
       
    36 	CleanupStack::PushL(hangup);
       
    37 	hangup->ConstructL();
       
    38 	CleanupStack::Pop();
       
    39 	return hangup;
       
    40 	}
       
    41 
       
    42 CATHangUpVoice::CATHangUpVoice(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
    43 											: CATCallAlterCommands(aIo,aTelObject,aInit,aPhoneGlobals)
       
    44 	{}
       
    45 
       
    46 CATHangUpVoice::~CATHangUpVoice()
       
    47 	{
       
    48 	iIo->RemoveExpectStrings(this);
       
    49 	}
       
    50 
       
    51 void CATHangUpVoice::ExecuteCommand(TTsyReqHandle aTsyReqHandle, TAny* aParams,TCallInfoTSY* aCallInfo)
       
    52 //
       
    53 //	Overloaded function ensures a hang up does not begin an initialise sequence
       
    54 //
       
    55 	{
       
    56 	iCallInfo = aCallInfo;
       
    57 	Start(aTsyReqHandle,aParams);
       
    58 	}
       
    59 
       
    60 void CATHangUpVoice::Start(TTsyReqHandle aTsyReqHandle,TAny* aParams)
       
    61 	{
       
    62 	LOGTEXT(_L8("Starting ATH Hang Up Voice Call Command"));
       
    63 	iReqHandle=aTsyReqHandle;
       
    64 	ChangeLineStatus(RCall::EStatusHangingUp);
       
    65 	// Setting to EStatusDialling always returns KErrNone
       
    66 	(void)ChangeCallStatus(RMobileCall::EStatusDisconnecting);
       
    67 	// must change status before calling 
       
    68 	// CheckNotification as the actual current status
       
    69 	// is written back with the notify completion.
       
    70 	// to prevent any completion of reqs synchronously when relinquishing ownership
       
    71 	// the server will cancel any completion of notifications such as call status change once
       
    72 	// this function has completed.
       
    73 	if (iCallInfo->iClientPanicOccurred==ENoPanicOccurred)
       
    74 		iPhoneGlobals->iNotificationStore->CheckNotification(REINTERPRET_CAST(CCallBase*,iTelObject),EBegunHangingUp);
       
    75 	__ASSERT_ALWAYS(iIo->AddExpectString(this,KNotifyMeIfErrorString) != NULL, Panic(EGeneral));
       
    76 	CATCallAlterCommands::Start(aTsyReqHandle,aParams);
       
    77 	REINTERPRET_CAST(CCallHayes*,iTelObject)->iWaitForNoCarrier->StopWait();
       
    78 	iIo->Cancel();
       
    79 	TCommConfig aConfigPckg;
       
    80 	TInt ret = iPhoneGlobals->iConfiguration->PortConfig(aConfigPckg,EConfigTypeHangUp);	
       
    81 	if (ret==KErrNone)
       
    82 		ret = iIo->ConfigurePort(aConfigPckg);
       
    83 	if (ret!=KErrNone)
       
    84 		{
       
    85 		Complete(ret,EReadCompletion); // EReadCompletion so another Read will not be queued
       
    86 		}
       
    87 	else
       
    88 		{
       
    89 		// No need to drop DTR on voice calls
       
    90 		Write(KHangUpCommand(),1);
       
    91 		iState=EATHangupWaitForWriteComplete;
       
    92 		}
       
    93 	}
       
    94 
       
    95 void CATHangUpVoice::Stop(TTsyReqHandle aTsyReqHandle)
       
    96 //
       
    97 //	Cancel the hang up (most often called from FlushReqs during a shutdown)
       
    98 //
       
    99 	{
       
   100 	__ASSERT_ALWAYS(aTsyReqHandle == iReqHandle,Panic(EIllegalTsyReqHandle));
       
   101 	LOGTEXT(_L8("Cancelling HangUp"));
       
   102 	iIo->WriteAndTimerCancel(this);
       
   103 	iIo->SetTimeOut(this,KOneSecondPause);
       
   104 	iState=EHangUpCancelling;
       
   105 	}
       
   106 
       
   107 
       
   108 void CATHangUpVoice::EventSignal(TEventSource aSource)
       
   109 	{
       
   110 	if (aSource==ETimeOutCompletion && iState!=EATHangupReadCompleted
       
   111 		&& iState!=EHangUpCancelling)
       
   112 		{
       
   113 		LOGTEXT(_L8("Timeout Error during Hang Up"));
       
   114 		Complete(KErrNone,aSource); // complete with KErrNone for hangup
       
   115 		return;
       
   116 		}
       
   117 	
       
   118 	switch(iState)
       
   119 		{
       
   120 	case EATHangupWaitForWriteComplete:
       
   121 		StandardWriteCompletionHandler(aSource,KTimeOut);
       
   122 		if (!iNoCarrierExpectString)
       
   123 			iNoCarrierExpectString=iIo->AddExpectString(this,KNoCarrierString);
       
   124 		iIo->Read();
       
   125 		iState=EATHangupReadCompleted;
       
   126 		break; 
       
   127 	
       
   128 //	case EATHangupReadCompleted:
       
   129 //		__ASSERT_ALWAYS(aSource!=EWriteCompletion,Panic(EATCommand_IllegalCompletionWriteNotExpected));
       
   130 //			{
       
   131 //			TInt ret=ValidateHangUpExpectString();
       
   132 //			if (ret)
       
   133 //				{
       
   134 //				Complete(ret,aSource);
       
   135 //				break;
       
   136 //				}
       
   137 //			RemoveStdExpectStrings();
       
   138 //			iState=EATHangupReadCompleted;
       
   139 //			}
       
   140 //		break;
       
   141 		
       
   142 	case EATHangupReadCompleted:
       
   143 		__ASSERT_ALWAYS(aSource!=EWriteCompletion,Panic(EATCommand_IllegalCompletionWriteNotExpected));
       
   144 		if (aSource==ETimeOutCompletion)
       
   145 			Complete(KErrNone,aSource);
       
   146 		else
       
   147 			{
       
   148 			TInt ret=ValidateHangUpExpectString();
       
   149 			Complete(ret,aSource);
       
   150 			}
       
   151 		break;
       
   152 		
       
   153 	case EHangUpCancelling:
       
   154 		if (aSource==EWriteCompletion)
       
   155 			{
       
   156 			iIo->SetTimeOut(this,KOneSecondPause);
       
   157 			}
       
   158 		if (aSource==EReadCompletion || aSource==ETimeOutCompletion)
       
   159 			{
       
   160 			LOGTEXT(_L8("Hang up cancelled"));
       
   161 			iIo->WriteAndTimerCancel(this);
       
   162 			iIo->RemoveExpectStrings(this);
       
   163 			iOKExpectString=NULL;
       
   164 			iErrorExpectString=NULL;
       
   165 			REINTERPRET_CAST(CCallHayes*,iTelObject)->SetToIdle();
       
   166 			iTelObject->ReqCompleted(iReqHandle,KErrCancel);
       
   167 			}
       
   168 		break;
       
   169 				
       
   170 	default:
       
   171 		;
       
   172 		}
       
   173 	}
       
   174 
       
   175 TInt CATHangUpVoice::ValidateHangUpExpectString()
       
   176 	{
       
   177 	CCommChatString* foundChatString = iIo->FoundChatString();
       
   178 	if (foundChatString == iNoCarrierExpectString)
       
   179 		{
       
   180 		LOGTEXT(_L8("Modem returned NO CARRIER in response to hang up command"));
       
   181 		return KErrNone;
       
   182 		}
       
   183 	if (foundChatString == iOKExpectString)
       
   184 		{
       
   185 		return KErrNone;
       
   186 		}
       
   187 	LOGTEXT(_L8("Hang up command\tunexpected match!"));
       
   188 	return KErrGeneral;
       
   189 	}
       
   190 
       
   191 
       
   192 void CATHangUpVoice::Complete(TInt aError,TEventSource aSource)
       
   193 	{
       
   194 	iIo->RemoveExpectStrings(this);
       
   195 	iNoCarrierExpectString=NULL;
       
   196 	REINTERPRET_CAST(CCallHayes*,iTelObject)->SetToIdle();
       
   197 	iIo->Cancel();
       
   198 	TCommConfig aConfigPckg;
       
   199 	aError = iPhoneGlobals->iConfiguration->PortConfig(aConfigPckg,EConfigTypeInit);
       
   200 	if (aError==KErrNone)
       
   201 		aError = iIo->ConfigurePort(aConfigPckg);
       
   202 	if((aSource==EWriteCompletion)||(aSource==ETimeOutCompletion))
       
   203 		iIo->Read();
       
   204 	CATCommands::Complete(aError,aSource);
       
   205 	if (iCallInfo->iClientPanicOccurred==ENoPanicOccurred)
       
   206 		{
       
   207 		iTelObject->ReqCompleted(iReqHandle, aError);
       
   208 		}
       
   209 	else
       
   210 		{
       
   211 		iComplete = CCompleteRelinquish::New(iTelObject);
       
   212 		iComplete->SetWhichCompletion(iCallInfo->iClientPanicOccurred);
       
   213 		iComplete->Call();	// calls the AysncOneShot Relinquish completion function
       
   214 		iCallInfo->iClientPanicOccurred = ENoPanicOccurred;
       
   215 		}	
       
   216 	iState=EATNotInProgress;
       
   217 	}
       
   218 
       
   219 
       
   220 //
       
   221 //
       
   222 // Hang Up Data Call
       
   223 //
       
   224 CATHangUpData* CATHangUpData::NewL(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
   225 	{
       
   226 	CATHangUpData* hangup=new(ELeave) CATHangUpData(aIo, aTelObject, aInit, aPhoneGlobals);
       
   227 	CleanupStack::PushL(hangup);
       
   228 	hangup->ConstructL();
       
   229 	CleanupStack::Pop();
       
   230 	return hangup;
       
   231 	}
       
   232 
       
   233 CATHangUpData::CATHangUpData(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
   234 											: CATCallAlterCommands(aIo,aTelObject,aInit,aPhoneGlobals)
       
   235 	{}
       
   236 
       
   237 CATHangUpData::~CATHangUpData()
       
   238 	{
       
   239 	iIo->RemoveExpectStrings(this);
       
   240 	}
       
   241 
       
   242 void CATHangUpData::ExecuteCommand(TTsyReqHandle aTsyReqHandle, TAny* aParams,TCallInfoTSY* aCallInfo)
       
   243 //
       
   244 //	Overloaded function ensures a hang up does not begin an initialise sequence
       
   245 //
       
   246 	{
       
   247 	iCallInfo = aCallInfo;
       
   248 	Start(aTsyReqHandle,aParams);
       
   249 	}
       
   250 
       
   251 void CATHangUpData::Start(TTsyReqHandle aTsyReqHandle,TAny* aParams)
       
   252 	{
       
   253 	LOGTEXT(_L8("Starting ATH Hang Up Command"));
       
   254 	iReqHandle=aTsyReqHandle;
       
   255 	ChangeLineStatus(RCall::EStatusHangingUp);
       
   256 	// Always returns KErrNone for EStatusDisconnecting
       
   257 	(void)ChangeCallStatus(RMobileCall::EStatusDisconnecting);
       
   258 										// must change status before calling 
       
   259 										// CheckNotification as the actual current status
       
   260 										// is written back with the notify completion.
       
   261 	// to prevent any completion of reqs synchronously when relinquishing ownership
       
   262 	// the server will cancel any completion of notifications such as call status change once
       
   263 	// this function has completed.
       
   264 	if (iCallInfo->iClientPanicOccurred==ENoPanicOccurred)
       
   265 		iPhoneGlobals->iNotificationStore->CheckNotification(REINTERPRET_CAST(CCallBase*,iTelObject),EBegunHangingUp);
       
   266 	
       
   267 	__ASSERT_ALWAYS(iIo->AddExpectString(this,KNotifyMeIfErrorString) != NULL, Panic(EGeneral));
       
   268 	CATCallAlterCommands::Start(aTsyReqHandle,aParams);
       
   269 	REINTERPRET_CAST(CCallHayes*,iTelObject)->iWaitForNoCarrier->StopWait();
       
   270 	iIo->Cancel();
       
   271 	TCommConfig aConfigPckg;
       
   272 	TInt ret = iPhoneGlobals->iConfiguration->PortConfig(aConfigPckg,EConfigTypeHangUp);	
       
   273 	if (ret==KErrNone)
       
   274 		ret = iIo->ConfigurePort(aConfigPckg);
       
   275 	if (ret!=KErrNone)
       
   276 		{
       
   277 		Complete(ret,EReadCompletion); // EReadCompletion so another Read will not be queued
       
   278 		}
       
   279 	else
       
   280 		{
       
   281 		iIo->DropDtr();		
       
   282 		iIo->SetTimeOut(this, KDTRLowPeriod);
       
   283 		iState=EDTRDropped;
       
   284 		}
       
   285 	}
       
   286 		
       
   287 void CATHangUpData::ValidateHangUpExpectStringL()
       
   288 	{
       
   289 	CCommChatString* foundChatString = iIo->FoundChatString();
       
   290 	if (foundChatString == iNoCarrierExpectString)
       
   291 		{
       
   292 		LOGTEXT(_L8("Modem returned NO CARRIER in response to hang up command"));
       
   293 		}
       
   294 	else if (foundChatString != iOKExpectString)
       
   295 		{
       
   296 		LOGTEXT(_L8("Modem returned unknown response to hang up command"));
       
   297 		User::Leave(KErrGeneral);
       
   298 		}	
       
   299 	}
       
   300 
       
   301 void CATHangUpData::Stop(TTsyReqHandle aTsyReqHandle)
       
   302 //
       
   303 //	Cancel the hang up (most often called from FlushReqs during a shutdown)
       
   304 //
       
   305 	{
       
   306 	__ASSERT_ALWAYS(aTsyReqHandle == iReqHandle,Panic(EIllegalTsyReqHandle));
       
   307 	LOGTEXT(_L8("Cancelling HangUp"));
       
   308 	iIo->WriteAndTimerCancel(this);
       
   309 	iIo->SetTimeOut(this,KOneSecondPause);
       
   310 	iState=EHangUpCancelling;
       
   311 	}
       
   312 
       
   313 void CATHangUpData::CompleteWithIOError(TEventSource /*aSource*/,TInt aStatus)
       
   314 	{
       
   315 	if (iState!=EATNotInProgress)
       
   316 		{
       
   317 		iIo->WriteAndTimerCancel(this);
       
   318 		iNoCarrierExpectString=NULL;
       
   319 		iErrorCode = aStatus;
       
   320 		//	SetToIdle calls CATWaitForNoCarrier::StopWait() which removes expect strings - 
       
   321 		//  this would cause a panic if they hadn't been removed already in 
       
   322 		//  CATHangUpData::Start(), because CATIO assumes all the CompleteWithIOError 
       
   323 		//  functions that it calls do not remove them. It removes them itself in
       
   324 		//  CATIO::SignalCommandsWithError().
       
   325 		STATIC_CAST(CCallHayes*,iTelObject)->SetToIdle();
       
   326 		User::After(KDeltaTimerDefaultGranularity);		// wait for a clock tick and continue
       
   327 		if (iCallInfo->iClientPanicOccurred != ENoPanicOccurred)
       
   328 			{
       
   329 			iComplete = CCompleteRelinquish::New(iTelObject);
       
   330 			iComplete->SetWhichCompletion(iCallInfo->iClientPanicOccurred);
       
   331 			iComplete->Call();	
       
   332 			iCallInfo->iClientPanicOccurred = ENoPanicOccurred;
       
   333 			}
       
   334 		else
       
   335 			iTelObject->ReqCompleted(iReqHandle, KErrNone);
       
   336 		iState = EATNotInProgress;
       
   337 		}
       
   338 	}
       
   339 
       
   340 void CATHangUpData::EventSignal(TEventSource aSource)
       
   341 	{
       
   342 	if (aSource==ETimeOutCompletion && iState!=EDTRDropped && iState!=EWaitForDTRRaiseSettle
       
   343 		&& iState!=EATEscapeSeqCompleted && iState!=EATHangupReadCompleted
       
   344 		&& iState!=EWaitForDTRRaiseSettle && iState!=EHangUpCancelling)
       
   345 		{
       
   346 		LOGTEXT(_L8("Timeout Error during Hang Up"));
       
   347 		Complete(KErrNone,aSource); // complete with KErrNone for hangup
       
   348 		return;
       
   349 		}
       
   350 	if (iErrorCode!=KErrNone)
       
   351 		{
       
   352 		if (!iNoCarrierExpectString)
       
   353 			iNoCarrierExpectString=iIo->AddExpectString(this,KNoCarrierString);
       
   354 		iErrorCode=KErrNone;
       
   355 		}
       
   356 
       
   357 	switch(iState)
       
   358 		{
       
   359 	case EDTRDropped:
       
   360 		__ASSERT_ALWAYS(aSource==ETimeOutCompletion,Panic(EATCommand_IllegalCompletionWaitExpected));
       
   361 		iIo->Cancel();
       
   362 		iIo->RaiseDTR();
       
   363 		iIo->Read();
       
   364 		iIo->SetTimeOut(this,KDTRHighSettle);
       
   365 		iState=EWaitForDTRRaiseSettle;
       
   366 		break;
       
   367 
       
   368 	case EWaitForDTRRaiseSettle:
       
   369 		__ASSERT_ALWAYS(aSource!=EWriteCompletion,Panic(EATCommand_IllegalCompletionWriteNotExpected));
       
   370 		if (aSource!=ETimeOutCompletion)
       
   371 			{
       
   372 			TRAPD(ret,ValidateHangUpExpectStringL());
       
   373 			Complete(ret,aSource);	
       
   374 			}
       
   375 		else
       
   376 			{
       
   377 			RemoveStdExpectStrings();
       
   378 			iIo->RemoveExpectString(iNoCarrierExpectString);// poss. problem as it removes CATWaitForNoCarrier's string too
       
   379 			iNoCarrierExpectString=NULL;
       
   380 			TBuf8<KCommsDbSvrMaxFieldLength> escapeChar;
       
   381 			TInt ret = iPhoneGlobals->iConfiguration->ConfigModemString(TPtrC(KCDTypeNameEscapeCharacter),escapeChar);
       
   382 			if (ret)
       
   383 				{
       
   384 				Complete(ret,aSource);
       
   385 				break;
       
   386 				}	
       
   387 			iTxBuffer.Format(_L8("%S%S%S"),&escapeChar,&escapeChar,&escapeChar);
       
   388 			iIo->Write(this,iTxBuffer);
       
   389 			iIo->SetTimeOut(this,KTimeOut*1000);
       
   390 			iState=EATEscapeSeqWaitForWriteComplete;
       
   391 			}
       
   392 		break;
       
   393 		
       
   394 	case EATEscapeSeqWaitForWriteComplete:
       
   395 		if (!iNoCarrierExpectString)
       
   396 			iNoCarrierExpectString=iIo->AddExpectString(this,KNoCarrierString);
       
   397 		StandardWriteCompletionHandler(aSource,KTimeOut);
       
   398 		iState=EATEscapeSeqCompleted;
       
   399 		break;
       
   400 
       
   401 	case EATEscapeSeqCompleted:
       
   402 		{
       
   403 		__ASSERT_ALWAYS(aSource!=EWriteCompletion,Panic(EATCommand_IllegalCompletionWriteNotExpected));
       
   404 		if (aSource!=ETimeOutCompletion)
       
   405 			{
       
   406 			TRAPD(ret,ValidateHangUpExpectStringL());
       
   407 			if (iIo->FoundChatString()==iNoCarrierExpectString || ret!=KErrNone)
       
   408 				{
       
   409 				Complete(ret,aSource); 
       
   410 				break;
       
   411 				}
       
   412 			}
       
   413 		RemoveStdExpectStrings();
       
   414 		iIo->RemoveExpectString(iNoCarrierExpectString);// poss. problem as it removes CATWaitForNoCarrier's string too
       
   415 		iNoCarrierExpectString=NULL;
       
   416 		Write(KHangUpCommand(),KTimeOut);
       
   417 		iState=EATHangupWaitForWriteComplete;
       
   418 		}
       
   419 		break;
       
   420 
       
   421 	case EATHangupWaitForWriteComplete:
       
   422 		StandardWriteCompletionHandler(aSource,KTimeOut);
       
   423 		if (!iNoCarrierExpectString)
       
   424 			iNoCarrierExpectString=iIo->AddExpectString(this,KNoCarrierString);
       
   425 		iState=EATHangupReadCompleted;
       
   426 		break;
       
   427 
       
   428 	case EATHangupReadCompleted:
       
   429 		__ASSERT_ALWAYS(aSource!=EWriteCompletion,Panic(EATCommand_IllegalCompletionWriteNotExpected));
       
   430 		if (aSource!=ETimeOutCompletion)
       
   431 			{
       
   432 			TRAPD(ret,ValidateHangUpExpectStringL());
       
   433 			Complete(ret,aSource);	
       
   434 			}
       
   435 		else
       
   436 			{
       
   437 			Complete(KErrTimedOut,aSource);
       
   438 			}
       
   439 		break;
       
   440 
       
   441 	case EHangUpCancelling:
       
   442 		if (aSource==EWriteCompletion)
       
   443 			{
       
   444 			iIo->SetTimeOut(this,KOneSecondPause);
       
   445 			}
       
   446 		if (aSource==EReadCompletion || aSource==ETimeOutCompletion)
       
   447 			{
       
   448 			LOGTEXT(_L8("Hang up cancelled"));
       
   449 			iIo->WriteAndTimerCancel(this);
       
   450 			iIo->RemoveExpectStrings(this);
       
   451 			iOKExpectString=NULL;
       
   452 			iErrorExpectString=NULL;
       
   453 			REINTERPRET_CAST(CCallHayes*,iTelObject)->SetToIdle();
       
   454 			iTelObject->ReqCompleted(iReqHandle,KErrCancel);
       
   455 			}
       
   456 		break;
       
   457 				
       
   458 	default:
       
   459 		;
       
   460 		}
       
   461 	}
       
   462 
       
   463 void CATHangUpData::Complete(TInt aError,TEventSource aSource)
       
   464 	{
       
   465 	RemoveStdExpectStrings();
       
   466 	iIo->RemoveExpectStrings(this);
       
   467 	iNoCarrierExpectString=NULL;
       
   468 	REINTERPRET_CAST(CCallHayes*,iTelObject)->SetToIdle();
       
   469 	iIo->Cancel();
       
   470 	TCommConfig aConfigPckg;
       
   471 	aError = iPhoneGlobals->iConfiguration->PortConfig(aConfigPckg,EConfigTypeInit);
       
   472 	if (aError==KErrNone)
       
   473 		aError = iIo->ConfigurePort(aConfigPckg);
       
   474 	if (aSource==EWriteCompletion)
       
   475 		iIo->Read();
       
   476 	CATCommands::Complete(aError,aSource);
       
   477 	if (iCallInfo->iClientPanicOccurred==ENoPanicOccurred)
       
   478 		{
       
   479 		iTelObject->ReqCompleted(iReqHandle, aError);
       
   480 		}
       
   481 	else
       
   482 		{
       
   483 		iComplete = CCompleteRelinquish::New(iTelObject);
       
   484 		iComplete->SetWhichCompletion(iCallInfo->iClientPanicOccurred);
       
   485 		iComplete->Call();	// calls the AysncOneShot Relinquish completion function
       
   486 		iCallInfo->iClientPanicOccurred = ENoPanicOccurred;
       
   487 		}	
       
   488 	iState=EATNotInProgress;
       
   489 	}
       
   490 
       
   491 //
       
   492 //	CATHangUpFax
       
   493 //
       
   494 
       
   495 CATHangUpFax* CATHangUpFax::NewL(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
   496 	{
       
   497 	CATHangUpFax* hangup=new(ELeave) CATHangUpFax(aIo, aTelObject, aInit,aPhoneGlobals);
       
   498 	CleanupStack::PushL(hangup);
       
   499 	hangup->ConstructL();
       
   500 	CleanupStack::Pop();
       
   501 	return hangup;
       
   502 	}
       
   503 
       
   504 CATHangUpFax::CATHangUpFax(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
       
   505 											: CATCallAlterCommands(aIo,aTelObject,aInit,aPhoneGlobals)
       
   506 	{}
       
   507 
       
   508 CATHangUpFax::~CATHangUpFax()
       
   509 	{}
       
   510 
       
   511 void CATHangUpFax::Start(TTsyReqHandle aTsyReqHandle, TAny* /*aParams*/)
       
   512 //
       
   513 //	When a fax call is terminated, modem is set to not initialised so that if a data call
       
   514 //  follows it will initialise the modem again.
       
   515 //
       
   516 	{
       
   517 	LOGTEXT(_L8("Starting HangUp fax call"));
       
   518 	iReqHandle=aTsyReqHandle;
       
   519 	iPhoneGlobals->iNotificationStore->CheckNotification(REINTERPRET_CAST(CCallBase*,iTelObject),EBegunHangingUp);
       
   520 	CCallMobileFax* faxCall = REINTERPRET_CAST(CCallMobileFax*,iTelObject);
       
   521 //	iPhoneGlobals->iPhoneStatus.iInitStatus = EPhoneNotInitialised;
       
   522 	faxCall->FaxHangUp(aTsyReqHandle);
       
   523 	}
       
   524 
       
   525 void CATHangUpFax::Stop(TTsyReqHandle aTsyReqHandle)
       
   526 //
       
   527 //	Too late to stop hang up process here. Only hope is if escape sequence or init sequence
       
   528 //	had to be performed first
       
   529 //
       
   530 	{
       
   531 	__ASSERT_ALWAYS(aTsyReqHandle == iReqHandle,Panic(EIllegalTsyReqHandle));
       
   532 	LOGTEXT(_L8("Too late to cancel Hang Up Command"));
       
   533 	}
       
   534 
       
   535 void CATHangUpFax::EventSignal(TEventSource /*aSource*/)
       
   536 	{}
       
   537 
       
   538 void CATHangUpFax::Complete(TInt /*aError*/,TEventSource /*aSource*/)
       
   539 	{}